change calls to exit into Gtk::Application::quit

this way destructors are called, and resources are properly freed