Fix balance_pool() race with next_in_queue() causing crashed builds.

The builds were failing with: eval: ${_HASH_priority_*...}: Bad substitution

Reported by:	peter