Fix multiprocessing memory leaks