diff --git a/madvr/madvr.py b/madvr/madvr.py index 285ea9e..dc7678a 100644 --- a/madvr/madvr.py +++ b/madvr/madvr.py @@ -100,8 +100,18 @@ def _clear_attr(self) -> None: def close_connection(self) -> None: """close the connection""" - self.client.close() - self.notification_client.close() + try: + self.client.close() + except AttributeError: + # means its already closed + pass + + try: + self.notification_client.close() + except AttributeError: + # means its already closed + pass + self.is_closed = True # Clear attr