diff --git a/clients/client-linux.py b/clients/client-linux.py
index 88909f9..8fa8bb2 100755
--- a/clients/client-linux.py
+++ b/clients/client-linux.py
@@ -344,10 +344,11 @@ if __name__ == '__main__':
             raise
         except socket.error:
             print("Disconnected...")
-            # keep on trying after a disconnect
-            s.close()
+            if 's' in locals().keys():
+                del s
             time.sleep(3)
         except Exception as e:
             print("Caught Exception:", e)
-            s.close()
+            if 's' in locals().keys():
+                del s
             time.sleep(3)
diff --git a/clients/client-psutil.py b/clients/client-psutil.py
index bffa407..799ce56 100755
--- a/clients/client-psutil.py
+++ b/clients/client-psutil.py
@@ -325,10 +325,11 @@ if __name__ == '__main__':
             raise
         except socket.error:
             print("Disconnected...")
-            # keep on trying after a disconnect
-            s.close()
+            if 's' in locals().keys():
+                del s
             time.sleep(3)
         except Exception as e:
             print("Caught Exception:", e)
-            s.close()
+            if 's' in locals().keys():
+                del s
             time.sleep(3)