Attempt to avoid race condition in test exiting.