USB Serial on Leonardo is affecting a sketch

I changed the one with the serial.available() in the for statement
For some reason the device likes the delays

For some reason the Leonardo didn't like something
it kept disappearing in device manager or the IDE when trying to open the serial monitor and even tried putty to see if it was arduino IDE
both said the COM4 was in use by another program.

I tried this

while (Serial1.available()==0)
{
  i=0;
}

I guess I could try this,

i=0
while (i<21)
{
  if (Serial1.available>0)
  {
     serData[I]=Serial1.read();
     i++;
  }
}