When an application windows is about to be closed and even already closed, your application is not terminated yet, so it can perform some action. If it is terminated, it's
too late. At this code, you don't any code running to detect the code is terminated. :-)
—SA