C++ stream limitations with SD card?

I’m using ofstream to write to the SD card and I’m having some new problems. To be clear, these issues showed up recently (within the last 2 weeks) without modifying the relevant code.

The first one is when using the write function.

out.write(in.first, std::distance(in.first, in.second));

in is a pair of char*. out is an ostream& to an open ofstream. I have checked that the file is open and previous calls to this code worked fine.

The program works fine, but about a minute and a half into the program, it enters the write line, and never makes it out. It doesn’t return and doesn’t throw any error.

The second issue is general writes. This developed more recently.

  std::ofstream file_init{"/usd/testfile1.txt", std::ofstream::trunc};
  file_init << "Hello";
  file_init.flush(); //doesn't get out of this

It doesn’t have to be a flush, any operation like endl, close, etc. hangs the program.

Is there any issue with the code or something I’m doing that isn’t allowed by PROS or the V5?