Hm, the error message for “Access denied” is rather generic, but mostly because another program (like the [Arduino] serial monitor) is using the COM port, or because some antivirus is blocking access to it.
Also if your Uno board is a clone with a CH340 chip on it, make sure to install the latest drivers.
There are some threads about it with generic solution hints, like
- trying different USB cables and ports on the computer
- reconnecting the device
- rebooting
- updating drivers
- changing the COM port number of the device in the device manager (here)
- kill eventually running avrdude.exe zombie processes hogging the port (here)
- temporarily disable additional antivirus software, if installed
- add PlatformIO tools / folders to the exception list of Windows Defender, especially the process name
avrdude.exe
- check if the behavior occurrs with other boards as well