'Called when a close frame has been decoded from the stream.
:param header: The decoded `Header`.
:param payload: The bytestring payload associated with the close frame.'

def handle_close(self, header, payload):

    if (not payload):
        self.close(1000, None)
        return
    if (len(payload) < 2):
        raise ProtocolError('Invalid    close    frame:    {0}    {1}'.format(header, payload))
    code = struct.unpack('!H', payload[:2])[0]
    payload = payload[2:]
    if payload:
        validator = Utf8Validator()
        val = validator.validate(payload)
        if (not val[0]):
            raise UnicodeError
    if (not self._is_valid_close_code(code)):
        raise ProtocolError('Invalid    close    code    {0}'.format(code))
    self.close(code, payload)
