How i can close every handler still opened on a file^^^

Hi, i am trying open a file but i get permission denied error. From what i searched on code every opened handler i close but i still get the error; i was thinking if i can close every handlers on a file. Thanks.

Image file, text/json file, or DB file?

Images

Delete all objects using that image and be sure they are garbage collected by nill-ing any references to those objects.

\_G.bill = display.newImageRect( "Bill.png", system.DocumentsDirectory, 100 , 100 ) \_G.bob = display.newImageRect( "Bob.png", system.DocumentsDirectory, 100, 100 ) display.remove(bill) bill = nil display.remove(bob) --[[At this point, "Bill.png" should\* be allowed to be overwritten or deleted. "Bob.png" cannot. \* May actually require a short time to be freed. --]]

Text Files

For text file… I suggest simply closing the file after every access.  i.e. Never leave an open handle.  There is no reason to keep a file handle open (none that I know of) and this ensures writes make it to the file.

If you’re written your own file access code, you may consider replacing it with this:

http://github.com/roaminggamer/SSKCorona/blob/master/ssk/extensions/io.lua

DB Files

I don’t know the answer for this one.

Image file, text/json file, or DB file?

Images

Delete all objects using that image and be sure they are garbage collected by nill-ing any references to those objects.

\_G.bill = display.newImageRect( "Bill.png", system.DocumentsDirectory, 100 , 100 ) \_G.bob = display.newImageRect( "Bob.png", system.DocumentsDirectory, 100, 100 ) display.remove(bill) bill = nil display.remove(bob) --[[At this point, "Bill.png" should\* be allowed to be overwritten or deleted. "Bob.png" cannot. \* May actually require a short time to be freed. --]]

Text Files

For text file… I suggest simply closing the file after every access.  i.e. Never leave an open handle.  There is no reason to keep a file handle open (none that I know of) and this ensures writes make it to the file.

If you’re written your own file access code, you may consider replacing it with this:

http://github.com/roaminggamer/SSKCorona/blob/master/ssk/extensions/io.lua

DB Files

I don’t know the answer for this one.