Its possible there could be race conditions for the Batch API finished callback since there is no signal for when a batch is fully populated.
Active
Code