How can I stop a program from logging data into an SD card?

Oh I see.. if I do if (digitalRead(somePin == HIGH)) I can then call SD.close(myFile) and stop reading or writing

I will give it a try, thanks!