Fix shutdown race with connections added to the pool.