<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def closed(self, code, reason=None):
 """Handler called when the WebSocket is closed. Status code 1000 denotes a normal close; all others are errors."""

        if code != 1000:
            self._error = errors.SignalFlowException(code, reason)
            _logger.info('Lost WebSocket connection with %s (%s: %s).',
                         self, code, reason)
            for c in self._channels.values():
                c.offer(WebSocketComputationChannel.END_SENTINEL)
        self._channels.clear()
        with self._connection_cv:
            self._connected = False
            self._connection_cv.notify()