Let's have a longer explanation. In this case, if you're using PICSTART or else programmer in MPLAB it will do this error IF your programmer is connected to the same PORT. IF SO, use Disable Programmer from the Programmer menu. Same rule apply if your using another software for your device programmer and the same port. you don't have the disable option? just shut-down the software.
In most case, PC modems (if some still have) are internal, and i don't remind they use the COM1 anyway.
Once a port is open, another regular program can't access or open it... just a COM sniffer can monitor it