'Close the handler and the temporary log file.
The temporary log file is deleted if it wasn\'t used.'

def close(self):

    self.acquire()
    try:
        self.stream.close()
        if self._delete:
            os.remove(self.path)
        self._delete = False
        if (sys.version_info < (2, 7)):
            logging.StreamHandler.close(self)
        else:
            super(TempHandler, self).close()
    finally:
        self.release()
