I'm not sure if you care about this, there's a small race condition here.  If running is true, it will pass this, but if a close happens in between, and then if running is set to false and the queue is empty, then the workers will die, and the item won't drain properly.