wont recognize comm port

I keep getting this error after compiling that wont download the code. does it on both mega mini and micro board, however computer recognizes the board on comm 4.

Arduino: 1.8.8 (Windows 10), Board: "Arduino Pro or Pro Mini, ATmega328P (5V, 16 MHz)"

Sketch uses 4756 bytes (15%) of program storage space. Maximum is 30720 bytes.
Global variables use 236 bytes (11%) of dynamic memory, leaving 1812 bytes for local variables. Maximum is 2048 bytes.
avrdude: ser_open(): can't set com-state for "\.\COM4"
An error occurred while uploading the sketch
This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

Try restarting your computer. Sometimes the COM port gets stuck in a bad state and the restart fixes that issue.

Just remember they will not all be COM 4 and that each type of board must be correctly selected in the IDE.

I know its sounds like a simple step but we have almost all forgotten to do that at some point.