Make sure tests wait for shutdown