Fix TestMonitor.test_atexit_hook.