let save_of_output output_function file sexp = let oc = open_out file in try output_function oc sexp; close_out oc; with e -> close_out_noerr oc; raise e