Shutdown thread factory when stopping