The current behavior will throw after reaching the first exception and only clears that partition in the finally block. This results in subsequent partitions not being cleared of tracking and potentially just throwing in the subsequent commit calls.
It also clears tracking for all partitions even if they are not in the list of partitions to flush.
#306 should fix these two issues.