SERVER-9518 Fix problem related to iterator invalidation.

Also, correctly handle deleted users and intermittent availability failures of the
user data collection.

Includes some unit testing.