I was facing this error as well. While I couldn't solve it, the process explorer told me that clang-tidy.exe was accessing the file at the same time it was being saved.
I end up pressing Ctrl+S until the saving is done.