Checking for game close?

I was wondering how I would check to find if the game was closed (not through my ingame menus,) but if they close the game through task manager or by closing from start bar, so if it is closed that way the game would still be able to save its progress