some cleanup of atexit worker termination, and fix nprocs==2 case