backport-1.7-3923

Backport #3923: `BUG: close file-like objects returned by urlopen`