Dynare has to run twice to execute at the second try

For some reason for each dynare mod I need to run twice to have it properly executed. Because in the first time I run it, I always encountered the folloiwng message:

Using 64-bit preprocessor
Starting Dynare (version 4.6.2).
Calling Dynare with arguments: none
Starting preprocessing of the model file …
Found 43 equation(s).
Evaluating expressions…done
Computing static model derivatives (order 1).
Computing dynamic model derivatives (order 3).
terminate called after throwing an instance of ‘std::filesystem::__cxx11::filesystem_error’
what(): filesystem error: cannot remove all [GSKDvsTiys]

There is no problem with my mod file (because I could run it smoothly on another computer). This problem started to emerge when the matlab crashed once while executing dynare. Any thoughts on how to avoid this issue going forward? Thank you.

This happens when the sub-folder that Dynare needs to delete for a run is locked by some process. Usually closing Matlab once helps. If that does not work, it may be an active cloud drive like Dropbox or an antivirus-program locking the files.