Only one application can access the Arduino Mega board, via the COM port, at a time. Sometimes, the software can get confused, and keep hold of the COM port, although this is unusual.
For example, if you are connected to your board via Pronterface, and without clicking on Pronterface's Disconnect button first, you then try to upload some code to the Arduino via the Arduino IDE, the Arduino IDE will just sit there complaining that it can not connect - usually with an error, or a timeout message, like this:
avrdude: stk500v2_ReceiveMessage(): timeout
See the video tutorial, #18: Calibration, by BuildA3DPrinter. It is a long video, but extremely informative. At 2:20 he has this exact problem. In fact, throughout the video, the instructor constantly reminds the viewer to disconnect from Pronterface before attempting to upload new firmware via the Arduino IDE.
Now, I know that this is the opposite of your issue, as your can not connect using Pronterface, after using the Arduino IDE, as opposed to the other way around, as shown in the video. However, the solution is most probably the same... Momentarily, disconnect the Arduino board from the USB (i.e. unplug the USB cable for a few seconds and then reconnect it). Then, without using the Arduino IDE, now try to connect Pronterface. It should now work - assuming that you have selected the correct COM port, baud rate etc.