Switched to tmpfile() where appropriate.