z_tempfile: add option to set the extension of the temporary file (useful for ImageMagick convert and similar programs)