Minor argsparser refactoring

This change separates the write creation / writing into a separate
function to make the code a bit more elegant.

It also removes the file because we occasionally run out of space in
/tmp
This can just be `defer file.Close()`, right?