def METHOD_NAME(pool):
    pool_sz = len(pool)
    pool[0].exit()
    pool[1].exit()
    pool[2].exit()
    time.sleep(1)  # wait for shutdown
    timeout = time.time() + TWAIT
    while len(pool) < pool_sz:
        time.sleep(0.1)
        if time.time() > timeout:
            raise TimeoutError(f"Failed to restart instance in {TWAIT} seconds")
    assert len(pool) == pool_sz
    pool._verify_unique_ports()