How can prevent that multiple robots working with the same file?

I develop a project that split excel to json queues.And i do things with those json queues and save them all in a text file then send mail this file. My question is that i want to process those queue items with multiple robots but in Write Text File Activity writes the same file.I thought that can cause the issue when robots tries to write the same file at the same time. How can i prevent it.
Thanks for help.

you can use retry scope activity

I dont know if it throws an error or not.I want to prevent it

Hi @alitolak

You could fill another queue with data to be saved and then run a quick process that will dump all the content to the file.