Seems a lot of threads are trying to get an access to the same files. It can't be allowed for all of them simultaneously, that's why first thread (instance) getting an access locks file while actions with it, then unlock.
Each thread has 3 attempts to access the file, separated by delay.