Empties the state stack when the user closes the window.