def close(self): self._stop() if self.process is not None: os.kill(self.process.pid, 15) self.process.wait() self.process = None