Pin13 change when connecting via USB

When I connect to my arduino (UNO and mega have the same issue) through USB by using the seruial monitor for example, Pin13 change and blink a few time.
The problem is that I'm using this pin for an SPI interface and I don't want it to blink when connecting with USB. Is there a way to stop it from blinking?

The blinking shouldn't be an issue for the SPI devices. If you really don't want the LED to blink, you can compile and flash your own version of the bootloader, with the LED flashes disabled: