Making sure that we lock the documents lock during batches