Bugfix: didn't check for terminate flag before writing temp file (rev.
11)

Signed-off-by: nixnodes <code@eth.si>