'Close and discard the lockfile without overwriting the target.
If the file is already closed, this is a no-op.'

def abort(self):

    if self._closed:
        return
    self._file.close()
    try:
        os.remove(self._lockfilename)
        self._closed = True
    except OSError as e:
        if (e.errno != errno.ENOENT):
            raise
        self._closed = True
