Remove generated code on IO errors

Bug: 25026025
Test: unit tests

Change-Id: Ice5d823102c742d546386f1ad71ef63a48c90820
diff --git a/code_writer.h b/code_writer.h
index 0519d74..7fac542 100644
--- a/code_writer.h
+++ b/code_writer.h
@@ -32,6 +32,7 @@
   // Write a formatted string to this writer in the usual printf sense.
   // Returns false on error.
   virtual bool Write(const char* format, ...) = 0;
+  virtual bool Close() = 0;
   virtual ~CodeWriter() = default;
 };  // class CodeWriter