def kill(wait=False): nonlocal killed futures.cancel() if executor: executor.shutdown(wait=wait) killed = True