Fixed a ResourceWarning that wasn't properly fixed by the previous commit.

Also removed unused import in runtests.py.
Fixed a few warnings in the testsuite.
Removed executeable bit from a few files.
Properly close any file in request.FILES at the end of a request.