Fixed exiting without saving data