I am not sure how much we can tell you about what your program is doing between when the last window closes and exit. Deleting a serious number of heap allocated objects might take some time especially if their destructor does something significant... but only you know what your program has to do, and it may not be this. It might be the orderly teardown of network or database connections.