Fix heartbeat behaviour after connection failure.

Make sure socket is closed by calling _adapter_disconnect()
Define self.heartbeat in initializer to avoid KeyError.
Connection heartbeat attribute must be unset to deactivate.