Avoid calling report_fatal_error in the destructor of raw_fd_ostream
when saving a module timestamp file

This commit doesn't include a test as it requires a test that reproduces
a file write/close error that couldn't really be constructed artificially.


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

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@304538 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 8679b18b176b0675a7d5c30551e2c271a9050239)
diff --git a/lib/Serialization/ASTReader.cpp b/lib/Serialization/ASTReader.cpp
index 039bbcc..90f08e7 100644
--- a/lib/Serialization/ASTReader.cpp
+++ b/lib/Serialization/ASTReader.cpp
@@ -3616,6 +3616,8 @@
   if (EC)
   OS << "Timestamp file\n";
+  OS.close();
+  OS.clear_error(); // Avoid triggering a fatal error.
 /// \brief Given a cursor at the start of an AST file, scan ahead and drop the