Fix read from closed input stream
Merge pull request #17 from derek63/fixreadfromclosedstream

Fix read from closed input stream