Fix quitting and saving/discarding changes