If passed an IO object that responds to #read, #close it after #read
Merge pull request #1040 from pdf/dont_leak_handles

An IO object passed to an uploader is never closed, so file handles are leaked