'Close the connection to the client. This also notifies all pending queries that their
request has failed.'

def close(self):

    close_quietly(self.socket)
    for callback in self.queries.values():
        callback.fn(False)
