Keep state files only when SaveOnExit is true
This was originally proposed in !98 by @mati7337. This MR resolves the merge conflict and brings the fix up to date against current master. This fixes that. SaveOnExit should now behave as the user expects, and this would make QubesOS (which uses xfwm4 by default) more secure since VM's shouldn't log the window titles of everything the user opens if the user explicitly states that `SaveOnExit=false`.