add tmpfile removal to TagWriter if write fails