Clearqueue

Add functionality to just clear a queue. Adds a help method to remove code duplication between clearQueue and closeQueue.