When you start up the compiled program, the MCR unpacks all the .m files (encrypted) under the Windows tmp folder. This is a haphazard place to put anything that needs to persist over a long period of time.
I added the following line in the startup script (feel free to come up with a folder of your choice):
Now, the files are stored in a safe place with no risk of periodical cleanup. I have not seen the problem during three weeks of testing. Also, since I run two parallel sessions of the same program, it allows me to use two different folders, avoiding possible clashes.
Thanks to the Matlab support team for working with me on this issue.