[QPID-5852]: [Python client] connection.opened() returns True after unsuccessful connection
diff --git a/qpid/messaging/endpoints.py b/qpid/messaging/endpoints.py
index a1d1af1..eb4c196 100644
--- a/qpid/messaging/endpoints.py
+++ b/qpid/messaging/endpoints.py
@@ -218,6 +218,9 @@
           raised this time but won't block future calls
           """
           self.error = None
+          raise e
+
+      self.close()
       raise e
 
   def get_error(self):