Metadata json locked

So I'm sure I'll need @foosel or @kantlivelong on this one but I've converted the UFP plugin to use the internal module add_file to move the extracted gcode to the uploads folder rather than doing it with os module and am getting this error now. Was wondering if there is a way around this or not?

2020-04-28 10:26:43,901 - octoprint.filemanager.storage - ERROR - Error while writing .metadata.json to C:\Users\jneil\AppData\Roaming\OctoPrint\uploads
Traceback (most recent call last):
  File "c:\octoprint\venv\lib\site-packages\octoprint\filemanager\storage.py", line 1583, in _save_metadata
    f.write(to_bytes(json.dumps(metadata, indent=4, separators=(",", ": "))))
  File "c:\python27\Lib\contextlib.py", line 24, in __exit__
    self.gen.next()
  File "c:\octoprint\venv\lib\site-packages\octoprint\util\__init__.py", line 1105, in atomic_write
    shutil.move(temp_config.name, filename)
  File "c:\python27\Lib\shutil.py", line 317, in move
    os.unlink(src)
WindowsError: [Error 32] The process cannot access the file because it is being used by another process: u'c:\\users\\jneil\\appdata\\local\\temp\\tmpsc10ri'

The corresponding code that is causing the error I'm sure is setting the additional_metadata which happens here.

You definitely didn't have .metadata.json open anywhere else or another instance of OctoPrint running? Shouldn't be an issue but could be worth disabling AV.

Thanks, didn't think of that. Had it open in Notepad++ to watch for changes. Since it detects file changes I didn't think it was actually locking the file, but apparently it was.