Wait for miner to shutdown using atexit