Cleanup app and mainwindow