Fix multiprocessing improper exit.