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

If you wrote a sketch to log data to a SD card, why can you not code it to stop the logging?