Race condition while updating single document multiple times

It worked after this change. I really appreciate your help with this issue.