[lldb] Fix bug where memory read --outfile is not truncating the file

The memory read --outfile command should truncate the output when unless
--append-outfile. Fix the bug and add a test.

rdar://76062318

Differential revision: https://reviews.llvm.org/D99890

GitOrigin-RevId: 710651c61dcdb2f969811b9a8c7efb425b5e2918
2 files changed