[MRG+1] Fixed ResourceWarnings from inside scikit-learn. Fixes #3410.

Remaining `ResourceWarning`s are due to a bug in Pillow (a PR is being created at the same time).
I believe that the two lines above (the assert_array...) shouldn't be in the 'with' block.