Attempt to fix Python multiprocessing issue leading to a memory leak.