Make pop and queue work properly when a queue is closed