A queue is closed when its handle is no longer needed and its resources may be freed. Closing a queue is done with a single call to MQCloseQueue.
Note When an application closes a queue, the queue handle becomes invalid, but the messages waiting in the queue remain in the queue. This includes any messages sent to the queue by the application closing the queue.
hr = MQCloseQueue(hQueue); //handle obtained from MQOpenQueue. If (FAILED(hr)) { // MQCloseQueue error handler. }