Before shutting down the program, you need to make sure that the shared resources are released, for example, connections to the database and web servers are closed. Servers for some time may consider your client still connected, which is undesirable. You should reset the data to disk in files if you care about their contents. If you do not care, you can not close - the system will cope on its own.
Freeing memory is usually unnecessary, even though it is a good tone rule. Moreover, if your program allocated a lot of complex objects in the memory, and the memory partially fell into a swap, then it may be beneficial not to free the memory so as not to force the system to pull information from the disk just to throw it away.
If you want to quickly complete the process, you can neatly destroy objects that store references to shared resources, and then just kill the process.
Moreover, ideally, the program should correctly handle the process of killing process at any time. The data should not be damaged. Working out the case of a hard kill process without careful release of memory and resources is an important point when developing programs. Because of this, your program should not cease to be workable (for example, due to corrupted configuration files).