Pass through the exit code properly

Also changed to `mktemp -t` that osx groks. OK on linux too?
Merge pull request #1 from johan/patch-1

Pass through the exit code properly