Fix iteration of unordered batches

Previously, initCurrentBatch() would never break its loop and return after creating a non-empty batch, which meant that a type's batch could be skipped entirely.

This change also ensures that we only create MappedBatch objects if there are operations to add.
Test that Bulk API cannot be executed multiple times