Close queues from the main process, with some special flakiness-avoiding...

... logic, because multiprocessing.queues is special :(

I don't believe the flakes don't affect operation, since they're thrown from queue feeder threads during shutdown.