Moving one line:
void loop() {
static int loops = 3; //FAIL - stops after the 3rd time
if ( loops){ //fAIL
loops = loops - 1;
for (int thisPin = 1; thisPin < pinCount; thisPin++) {
// turn the pin on:
digitalWrite(thisPin, HIGH);
delay(timer);
// turn the pin off:
digitalWrite(thisPin, LOW);
}
}