diff --git a/hp4155/memristor_final/help.py b/hp4155/memristor_final/help.py
index 8de07ce54472f2de3d525a802dc8083591df30e9..96851a571213a3cd22a0c6fd695a73d2efe7f485 100644
--- a/hp4155/memristor_final/help.py
+++ b/hp4155/memristor_final/help.py
@@ -85,6 +85,8 @@ def test_contacts():
             print(f"R{i}{j}:{R} Ohm")
             #print(f"Contact check of smu{i} and smu{j} failed!")
     
+    del device
+    
 
 
 #double sweep from start to stop and then from start to stop
diff --git a/hp4155/memristor_final/memristor.py b/hp4155/memristor_final/memristor.py
index 8db2534c51429f9ce65189fedcfff95cc84ab684..9b4fc48bcadc25da28f066293e23d6cf7dfa970d 100644
--- a/hp4155/memristor_final/memristor.py
+++ b/hp4155/memristor_final/memristor.py
@@ -273,6 +273,8 @@ def on_set_button_clicked(b):
 
         #unlock device
         device.inst.unlock()
+
+        del device
         
         change_state(buttons)
         change_state(parameters)