diff --git a/test/test_main_window.py b/test/test_main_window.py
index dc6691d86bf8df1c21785ac7c09601378e6ebc62..8026c2663cec1767e431071173eb61a97276d066 100644
--- a/test/test_main_window.py
+++ b/test/test_main_window.py
@@ -34,8 +34,7 @@ class TestMainWindow(unittest.TestCase):
 
     def delete_db(self):
         """Delete generated 'testDatabase'-file."""
-        del self.test_mw.timer
-        del self.test_mw
+        self.test_mw.database.conn.close()
         if os.path.exists(TESTDBPATH):
             os.remove(TESTDBPATH)