"Serial port "COM4" not found" error BUT port shows up in device manager

Hello, everyone,

I know many people have come with the serial port not found error in this forum already, but all of the ones i saw couldn't see their ports in the device manager. The problem is that sometimes the upload works, sometimes it doesn't, giving the "Serial port "COMx" not found. Did you select the right one from the Tools->Serial port menu?" error, where x varies with the board.

I am running Windows7-64bit, and tried using both the Arduino app version 1.0.1 and 1.0.3. Also tried using an Uno R1, an Uno R2, and a Mega 2560. The problem happens less often in the Uno R2, but still happens sometimes.

Reconnecting, closing the program, or rebooting worked a couple of times, but not always. I am pretty puzzled about this problem, because the port shows up normally in the Device Manager even when the upload is not working, under Ports (COM & LPT) and with the right board name everytime. Could you please help me fix this? I'm currently working on an university project, and the deadline is closing in...

Thanks a lot in advance!