'Closes the socket.'

def close(self):

    self.acquire()
    try:
        if self.sock:
            self.sock.close()
            self.sock = None
    finally:
        self.release()
    logging.Handler.close(self)
