writer: write to tmp file first