enhanced exception safety of tmp-file