Fix zombie process issue by spawning threads to join processes