[libcxx] Avoid double frees of file descriptors in the fallback ifstream/ofstream codepath

So far, most actual uses of libc++ std::filesystem probably use
the sendfile or fcopyfile implementations.

Differential Revision: https://reviews.llvm.org/D90601

GitOrigin-RevId: 08b4cc5e0d2625e85ed4af9aad17ccc0876e3bd3
diff --git a/src/filesystem/operations.cpp b/src/filesystem/operations.cpp
index 788e31b..6a25979 100644
--- a/src/filesystem/operations.cpp
+++ b/src/filesystem/operations.cpp
@@ -684,12 +684,14 @@
       ec = capture_errno();
       return false;
     }
+    read_fd.fd = -1;
     ofstream out;
     out.__open(write_fd.fd, ios::binary);
     if (!out.is_open()) {
       ec = capture_errno();
       return false;
     }
+    write_fd.fd = -1;
 
     if (in.good() && out.good()) {
       using InIt = istreambuf_iterator<char>;