Unwanted data stored in SD card

You could be opening and closing the file in the loop, but who would ever know?