Release lock when the file is already processed.
Optimize the recursive call fillBatch().