Move the tempfile into the loop body

It's easy to avoid this dependency by creating a new copy in each time.

See #7.