Close tempfile after upload

On a big project I've been working on we've had an issue where the test
suite handles a lot of file uploads. And as the total number of uploads
goes over 250 we would start getting core Ruby failures from reading
files. It couldn't even load normal .rb files anymore.

We fixed our test suite by making sure that tempfile closes the file it
was working on after it has been copied.