Fix some hide/locking issues and save layout before Gtk.main_quit.