let with_file_out ?level fn ~f = let oz = open_out ?level fn in let r = try `Ok (f oz) with e -> `Error e in close_out oz ; match r with | `Ok y -> y | `Error exn -> raise exn