             result[i] = statistics
             callback null, result if callback unless --total_queues
 
+  close: (callback) ->
+    close_callback = callback
+    clean_up()
 
 # ## Class Queue
 

# If there's no registered workers, exit directly.
first_time = on
clean_up = ->
  # console.log 'clean up'
  log_registered_workers() unless first_time
  first_time = off
  return setTimeout((->process.exit()), 100) unless workers.length
  exiting = on
  for worker in workers
    worker.unregist() if worker.is_idling


  # **Private** method. Wait if there're queues still working, or exit the
  # process immediately.
  unregist: (callback) =>
    @redis.hdel @key('WORKERS'), @id, (err, res) =>
      workers.splice workers.indexOf(@), 1
      return if workers.length
      if close_callback
        close_callback()
      else
        process.exit()
