Fixes IOError when piping query output
Merge pull request #134 from larssono/master

Fixes IOError when piping query output