A bit unclear exactly what happens, but some process have locked the files we want to write to. Repeated attempts tend to report a different file being the locked file.
Might be related to some kind of antivirus, OneDrive sync/check or anything like that, since it seems to be different files each time. Then again, sometimes cleaning the solution in Visual Studio helps, or restarting Visual Studio. Sometimes the entire computer needs to be restarted in order for the files to be left alone.