When the application closes, do not release things in the finalization section.
1) When the application shuts down, Windows frees up all the application memory. You do not have to do this.
2) When the application shuts down, memory is freed and the infrastructure is unloaded. You cannot call code to close or release objects, as this code may have already been unloaded. You cannot access pointers in memory, as these pointers may already be issued.
3) When you try to free things in the finalization section while the application is closing, you may get crashes that prevent your code from completing, thereby preventing the application from closing, causing the application to freeze and memory loss. This is what you tried to prevent in the first place. Do not do this.
Well, when you work on Win95 / 98 or use external processes, you can in some cases free up shared resources and notify those external processes that you are completing. In addition, all this happens automatically.
source share