BUG: close file-like objects returned by urlopen

Fix `ResourceWarning: unclosed file` on Python 3
Merge pull request #3923 from cgohlke/patch-1

BUG: close file-like objects returned by urlopen