fix for not closed stream
Merge pull request #1 from marcinburo/master

fix for not closed stream