'Flush, set the target to None and lose the buffer.'

def close(self):

    self.flush()
    self.acquire()
    try:
        self.target = None
        BufferingHandler.close(self)
    finally:
        self.release()
