Can't open device COM, access is denied - not even using those COMs

So my code was uploading to my arduino nano just a little while ago. The port is set to COM7, the same that it was set to when it was working, and when I upload it to the arduino it says it cannot open COM11, which I am not even using. I tried using the other 2 ports on my laptop, COM6 and COM9, and for both I am getting that it cannot open COM10 (when connected to COM6) and COM8 (when connected to COM9). Any idea what might be going on?

Purely a wild guess: try restarting your computer. Sometimes the COM ports will get stuck in a weird configuration and restarting fixes this.