SD card data acquisition

After making some changes to my code everything seems to be running smoothly. The only problem I'm having now is that while pin 13 has no power the clock is still ticking. Is there a way to make it so that the clock stays at zero till pin 3 reads high.

#include <SD.h>

File file;

void setup()
{

  // Sets analog pins to input
  pinMode(A0, INPUT);
  pinMode(A1, INPUT);
  pinMode(A2, INPUT);
  pinMode(A3, INPUT);

  // Sets analog pins to input
  pinMode(3, INPUT);
  pinMode(2, OUTPUT);


  // Opens the serail connection
  Serial.begin(500000);
  SD.begin(10);
  file = SD.open("WR_TEST5.TXT", O_CREAT | O_WRITE);
  
}

void loop()

{
  unsigned long startTime = 0;
  unsigned long intreval = 2000UL; // 120 seconds
  unsigned long previousInterval = 0;
  unsigned long intreval1 = 5000UL; // 60 seconds
  unsigned long previousInterval1 = 0;

  delayMicroseconds(10);

  while  (digitalRead(3) == HIGH)
  {
    delayMicroseconds(100);
    startTime = millis();

    for (; millis() < startTime + 2000UL;)
    {
      char tuf[10];
      digitalWrite(2, LOW);
      sprintf(tuf, "low ");
      //Serial.print(tuf);
      file.print(tuf);
      dataLog();

      if (digitalRead(3) == LOW)
      {
        break;
      }

    }

    for (; millis() < startTime + 7000UL;)
    {
      char tuf1[10];
      digitalWrite(2, HIGH);
      sprintf(tuf1, "high ");
      //Serial.print(tuf1);
      file.print(tuf1);

      dataLog();


      if (digitalRead(3) == LOW)
      {
        break;
      }
    } file.flush();
  }
}


void dataLog()
{
  char buf[100];
  char buf1[50];

  //Pressure transducers
  int PT1A;
  int PTT1;
  int PT1B;
  int PT1C;



  unsigned long runMillis = millis();
  unsigned long allSeconds = millis() / 1000;
  int runHours = allSeconds / 3600;
  int secsRemaining = allSeconds % 3600;
  int runMinutes = secsRemaining / 60;
  int runSeconds = secsRemaining % 60;

  // Sets values of incoming analog pin data to transducer nnumbers
  PT1A = analogRead(A0); // Reads data from analog pin A0
  PTT1 = analogRead(A1); // Reads data from analog pin A1
  PT1B = analogRead(A2); // Reads data from analog pin A2
  PT1C = analogRead(A3); // Reads data from analog pin A3


  sprintf(buf, "Runtime%02d:%02d:%02d ", runHours, runMinutes,
          runSeconds);
  sprintf(buf1, "PT1A: %d; PTT1: %d; PT1B: %d; PT1C: %d", PT1A, PTT1, PT1B, PT1C);
  /*Serial.print(buf);
    Serial.println(buf1);*/

  file.print(buf);
  file.println(buf1);

}