I am trying to create function ti save new progress in a file in the DocumentsDirectory. I get the errero:Permissiin denied, but i checked the previous case when i open the file after i close it…
This can happen if you’re attempting to overwrite a file that is currently open and locked by the file system. Especially on Windows, which is much more aggressive about file locking.
I recommend that you double check the code where you that file closes it too. And if it happens to be an image file that you’re display via Corona, then you’ll need to remove all display objects that reference that image file. Then you’ll be able to overwrite it.
Ok,the problem is that i have checked every time i opened before to get error and i always closed. 
This can happen if you’re attempting to overwrite a file that is currently open and locked by the file system. Especially on Windows, which is much more aggressive about file locking.
I recommend that you double check the code where you that file closes it too. And if it happens to be an image file that you’re display via Corona, then you’ll need to remove all display objects that reference that image file. Then you’ll be able to overwrite it.
Ok,the problem is that i have checked every time i opened before to get error and i always closed. 