diff --git a/modules/gui/src/main.cc b/modules/gui/src/main.cc
index 61d6b05d8227dd1d1f36be1578c514607fa62a24..f3b1c6f6e76f005ab2701a976980bd5af5cfb3a9 100644
--- a/modules/gui/src/main.cc
+++ b/modules/gui/src/main.cc
@@ -93,7 +93,9 @@ void GostyMainWindow::OnQuit()
   //SetFullScreen(false);
   GostyApp::Instance()->OnQuit();
   deleteLater();
-  QApplication::exit(0);
+  // exit has to be called on the instance not the class,
+  // otherwise the aboutToQuit singal doesn't get emitted
+  QApplication::instance()->exit(0);
 }
 
 void GostyMainWindow::closeEvent(QCloseEvent * event)
diff --git a/modules/gui/src/messages/log_reader.cc b/modules/gui/src/messages/log_reader.cc
index 3562df102ffb13a9a72bae29183d56732830849f..33ad612ba2e73ce8245c481c5e2701e17aaec82c 100644
--- a/modules/gui/src/messages/log_reader.cc
+++ b/modules/gui/src/messages/log_reader.cc
@@ -72,8 +72,6 @@ QMessageBox::Icon LogReader::GetIconForSeverity(int severity){
 }
 
 LogReader::~LogReader() {
-  ost::Logger& logger = ost::Logger::Instance();
-  logger.PopSink();
 }
 
 }
diff --git a/modules/gui/src/python_shell/python_interpreter_worker.cc b/modules/gui/src/python_shell/python_interpreter_worker.cc
index b89859142642c21d4fc6f624b9727aa27d35dc81..47dbcfc9e27282c6ec3b3f0e06203fb87b87b0b8 100644
--- a/modules/gui/src/python_shell/python_interpreter_worker.cc
+++ b/modules/gui/src/python_shell/python_interpreter_worker.cc
@@ -51,6 +51,12 @@ PythonInterpreterWorker::PythonInterpreterWorker():
   main_namespace_["sys"].attr("stdout") = output_redirector_;
 }
 
+PythonInterpreterWorker::~PythonInterpreterWorker()
+{
+  // we have to manually run the exit functions because we cannot use Py_Finalize due to some problems in boost python
+  run_command_(std::pair<unsigned int, QString>(0,"import atexit\natexit._run_exitfuncs()\n"));
+}
+
 void PythonInterpreterWorker::Wake()
 {
   if (awake_) return;
diff --git a/modules/gui/src/python_shell/python_interpreter_worker.hh b/modules/gui/src/python_shell/python_interpreter_worker.hh
index 4c36b27507f44879fbe9346e49cc7ee3b0265e31..ed80f6fe78b308f1269a5a723bffe46883fbe35b 100644
--- a/modules/gui/src/python_shell/python_interpreter_worker.hh
+++ b/modules/gui/src/python_shell/python_interpreter_worker.hh
@@ -20,6 +20,7 @@ class PythonInterpreterWorker: public QObject
 Q_OBJECT
 public:
   PythonInterpreterWorker();
+  ~PythonInterpreterWorker();
   unsigned int AddCommand(const QString& command);
 
 signals: