bugfix when trying to close without saving