TommyCarlier said:
Console applications are not meant to be closed by the user. They don't have a message loop and should shut down when their task has been performed.

This console app performs calculations that are particularly expensive. So I cache them in a hash_map. What I am doing is writing the hash_map to disk so that I can repopulate the cache when the app starts up again. I do also save the cache to disk once in a while just in case the app were to crash.

I guess what I could do is increase the frequency to which I save the cache while the app is running, but I will lose any calculations between when I last saved and when I close the app.