Arduino DUE dos not Write After Reading from SD

Context: i have two files on an SD card, file A and File B. in the Set up void, i am opening one file, reading the contents, closing and then repeating it for the second file.

I then later on in the void loop, try to write to the SD card File C and file D.

i open the file, write and close, and repeat.

so far i am only able to read A and B, or Write C and D, i am not able to do both in the same sketch. any ideas?

CODE sample:

void setup() {
  SD.begin(53);

Data_logger = SD.open("A.txt");
    
    while (Data_logger.available())
    {

      A_sd_read = Data_logger.read();

      // do stuff with the stuff
    }
     
   Data_logger.close(); 


// read B
    
    Data_logger = SD.open("B.txt");
    
    while (Data_logger.available())
    {

      B_sd_read= Data_logger.read();

   // do stuff with the stuff
    }
     
    Data_logger.close();
}

void loop() {

  Data_logger_reg = SD.open("C.txt",FILE_WRITE);      
  Data_logger_reg.print(C_Stuff);
  Data_logger_reg.close();

  Data_logger_reg = SD.open("D.txt",FILE_WRITE);
  Data_logger_reg.print(D_Stuff);
  Data_logger_reg.close();

}

Maybe use four different names for your four instances of SD?

Did you try the example sketch provided in File>Example>SD>ReadWrite ?

And BTW, SPI CS pins are 4, 10 or 50 (see Graynomad pinout diagram).

will work on the sketch once i have some hardware again,

i see lots of documentation for CS pins but they all have different pins for the DUE, some mention 50,51,52 and 53 so its very confusing.. i also thought you only need to use that specific pin if you use a slave system or something