Properly handle turning the GUI off