Called when the connection is closed

def closed(self, code, reason=None):
        """Called when the connection is closed"""
        self.emit('socket_closed', code, reason)
        self._recover_network_failure()