datalogger for counter sensor with RTC HELP!

PaulS:
You open the file. Where do you close it?

 File logFile = SD.open("DATALOG.csv", FILE_WRITE);
  if (logFile)
  {
    logFile.print(buttonBeeCounterA);
    logFile.print(",");
    logFile.println(buttonBeeCounterB); 
    logFile.close();
    
	
   

    Serial.print(buttonBeeCounterA);
    Serial.print(",");
    Serial.println(buttonBeeCounterB);






    		
 }
else

{
    Serial.println("LogFile cannot be opened");

	}

}

i followed it but same result as the string does. so many data being stored, tons of data. i wonder why?

same result as this