Fixed graceful shutdown bug (which caused workers to keep working)