The problem is the timeout input on your dequeue node is set to -1 which means it will wait forever until there is an element to dequeue.
One of the primary rules of data flow is any structure (in this case a while loop) must wait until all items are complete before it can continue.
In your program the loop is waiting for the dequeue node to complete and the node is waiting for an element to be put in the queue.
The node will also release if the queue reference is destroyed.
So one solution would be to set the stop buttons and then destroy all of the queues.
This should release the dequeue node and let the while loop continue.
Closing the queue reference will also produce an error out of the dequeue node and many programmers wire the error out to the stop terminal of the while loop.
The Producer/Consumer Design Pattern (Data) uses this method.
Hope this helps
Mark