added optional close of queue to support threads