OS.File.writeAtomic is giving winLastError 1224

Hi all I can’t figure this error out.

I write a file to a path with OS.File.writeAtomic. It works the first time.

I write again a second time to that file with same exact data, this time it gives me winLastError of 1224 which is ERROR_USER_MAPPED_FILE https://msdn.microsoft.com/en-us/library/windows/desktop/ms681383(v=vs.85).aspx

I can’t figure out why I’m getting this error and how to fix it. Anyone any ideas?

I think it’s because I had to make a nsIFile out of that path in order to use with AddonManager.installAsTemporaryAddon.

Is there any way to close a nsIFile after having opened it with:

var xpi = new FileUtils.File(path to file)

?