Arduno Leonardo not responding

so recently, I programmed my Arduino Leonardo to act as a keyboard, while displaying the input to the serial monitor.

This program worked just fine but after uploading it, I couldn't upload any other sketch. The programmer wasn't responding anmore due to the frequent transmits made by the Serial communication.

Has this anything to do with the Serial1 class available on the Leonardo?
And is there any way to erase the flash on the Leoardo, like on a DUE or Mega Board?

Reset the Leonardo using the reset button, then in the tools menu, select the new COM port that appeared. Compile the code, reset the Leonardo again, and hit upload immediately after.

Pieter