Trying to eliminate shutdown thread races in tests