Execute template into a buffer to avoid partial output and properly catch errors before writing