Cannot program esp32

running platformio on windows 10, vs code. connected to nodemcu esp32-s. Whenever I try to program the device, I get this error. Any suggestions? Thank you! v2.6
Serial port COM5
Traceback (most recent call last):
File “C:\Users\amikam.platformio\packages\tool-esptoolpy\”, line 2959, in
File “C:\Users\amikam.platformio\packages\tool-esptoolpy\”, line 2952, in _main
File “C:\Users\amikam.platformio\packages\tool-esptoolpy\”, line 2653, in main
File “C:\Users\amikam.platformio\packages\tool-esptoolpy\”, line 460, in connect
last_error = self._connect_attempt(mode=mode, esp32r0_delay=False)
File “C:\Users\amikam.platformio\packages\tool-esptoolpy\”, line 440, in _connect_attempt
File “C:\Users\amikam.platformio\packages\tool-esptoolpy\”, line 379, in sync
File “C:\Users\amikam.platformio\packages\tool-esptoolpy\”, line 343, in command
self._port.timeout = saved_timeout
File “c:\users\amikam.platformio\penv\lib\site-packages\serial\”, line 368, in timeout
File “c:\users\amikam.platformio\penv\lib\site-packages\serial\”, line 222, in _reconfigure_port
‘Original message: {!r}’.format(ctypes.WinError()))
serial.serialutil.SerialException: Cannot configure port, something went wrong. Original message: WindowsError(995, ‘The I/O operation has been aborted because of either a thread exit or an application request.’)
*** [upload] Error 1

Is another program accessing COM5? Does this help?

No. Not that I can determine.

I ran procexp, and no other process is accessing the port. In addition, I can open the port with a terminal program like putty or termite

Have you tried to use a slower upload_speed?