def __release(self): self.timer.cancel() self.timer = None fcntl.flock(self.fd, fcntl.LOCK_UN) os.close(self.fd)