properly stop miner threads