Return weakref to queue.

Instead of explicitly flushing the queue, return a weakref proxy object
wrapping the queue. Thus when the context exits, the queue object will be
unconditionally destroyed. That way it can't be kept alive full of junk because
nobody else can hold a real reference to it.