pool.end(cb) sometimes calles cb direcly other times sometime later

When calling pool.end(cb) cb is sometimes called synchronously and other times asynchronously.