kill the app on main window close, and make mqtt a daemon thread