fix race on exit resulting in SEGV and unable to reboot.