IMPALA-853: Fix eof corner case and some error handling.

Change-Id: I376fceba4c16ccd0a339c7ef6846bee6ce58c871