adds option to save when exiting