Cleans up existing connections giving them time to finish the currect
        request.

def cleanup(self):
        '''
        Cleans up existing connections giving them time to finish the currect
        request.
        '''
        self.debug("Cleanup called on Site.")
        if not self.connections:
            return defer.succeed(None)
        self.debug("Waiting for all the connections to close.")
        result = self._notifier.wait('idle')
        for connection in self.connections:
            connection.persistent = False
            if not connection.requests:
                connection.transport.loseConnection()
            else:
                request = connection.requests[0]
                peer = connection.transport.getPeer()
                self.debug("Site is still processing a %s request from %s:%s"
                           " to path: %s. It will be given a time to finish",
                           request.method, peer.host, peer.port, request.path)
        return result