I am on Windows 10 and I got this error but even after PC restart and opening with admin privileges didnt fix my problem.
So it seemd that my repository privileges was the problem.
Just to be sure I installed all new Windows updates, thenI restarted my PC and finally I removed all unnecessary privileges.
Run powershell as admin and run:
attrib -s <path_to_your_directory> attrib -r -a <path_to_your_directory>
Details about this powershell command are here:https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/attrib