Help with logic in saving tables

mm there’s somethign wrong as it doesn’t save any table. This is the whole draw()

void draw(){
  background(30);
  textSize(32);
  textAlign(CENTER, CENTER);
  
  if(runApp){
    text("Recording", width/2, height/2); 
    
    osc.amp(1);
    osc.play();

    int curTime = millis();
    int timeDiff = curTime - startTime;

    int indexForFileNames=-1;
    boolean saveThis = false; // tells the sketch to save  
    
    if (timeDiff < recTime) {      
      osc.freq(freqList[0]);
      indexForFileNames=0;
    } else if (timeDiff >= recTime && timeDiff < recTime*2) {
      if (indexForFileNames==0) {
        saveThis=true;
      }
      osc.freq(freqList[1]);
      indexForFileNames=1;
    } else if (timeDiff >= recTime*2 && timeDiff < recTime*3) {
      if (indexForFileNames==1) {
        saveThis=true;
      }
      osc.freq(freqList[2]);
      indexForFileNames=2;
    } else if (timeDiff >= recTime*3 && timeDiff < recTime*4) {
      if (indexForFileNames==2) {
        saveThis=true;
      }
      osc.freq(freqList[3]);
      indexForFileNames=3;
    } else if (timeDiff >= recTime*4 && timeDiff < recTime*5) {
      if (indexForFileNames==3) {
        saveThis=true;
      }
      osc.freq(freqList[4]);
      indexForFileNames=4;
    } else if (timeDiff >= recTime*5 && timeDiff < recTime*6) {
      if (indexForFileNames==4) {
        saveThis=true;
      }
      osc.freq(freqList[5]);
      indexForFileNames=5;
    } else
      startTime = millis();
    
    
    // this is never run
    if (saveThis && (indexForFileNames>0)) {
      saveTable(table, fileNames[indexForFileNames - 1]); // using -1 here !!!!
      saveThis = false;
      
      if(indexForFileNames == 5){
        runApp = false;
        exit();
      }
        
    }
           
  }else
    text("Idle", width/2, height/2); 

}