Concurrent ref iterator access

We may loose some packed refs by re-using the sortedcache, which may be reloaded at any time. With this, we isolate the iterator from outside changes (though only up to the point that the packed-refs can be snapshotted).

I think we should at least try to provide this kind of snapshotting in the iterator, and this also fixes what the test actually does, which is remove a ref from packing, where out offset gets out of sync with the actual contents.

Thoughts?

/cc @arrbee