Fix shutdown hangs

Cleanup of the NiftyBootstrap/NiftyClient shutdown code. Before this, some tests
failed on Linux, and some tests that were passing on mac were spinning 100% CPU
for a while after successfully finishing the test.