file-to-source: Check errors from write_file, output end marker
utils: write_file: truncate file on open

Hopefully fixes the emilpro_glade.hh generation issues...