fixed IOError when stdout piped to programs that close stdout
Merge pull request #13 from teharrison/master

fixed IOError when stdout piped to programs that close stdout