diff --git a/pychromecast/socket_client.py b/pychromecast/socket_client.py
index <HASH>..<HASH> 100644
--- a/pychromecast/socket_client.py
+++ b/pychromecast/socket_client.py
@@ -753,12 +753,13 @@ class SocketClient(threading.Thread):
             except Exception:  # pylint: disable=broad-except
                 pass
 
-        try:
-            self.socket.close()
-        except Exception:  # pylint: disable=broad-except
-            self.logger.exception(
-                "[%s(%s):%s] _cleanup", self.fn or "", self.host, self.port
-            )
+        if self.socket is not None:
+            try:
+                self.socket.close()
+            except Exception:  # pylint: disable=broad-except
+                self.logger.exception(
+                    "[%s(%s):%s] _cleanup", self.fn or "", self.host, self.port
+                )
         self._report_connection_status(
             ConnectionStatus(
                 CONNECTION_STATUS_DISCONNECTED, NetworkAddress(self.host, self.port)
Don't throw if socket closed when cleaning up (#<I>)