finalize batches