Raise exception for unfinished queries.

Raise UnfinishedQueryException if trying to get query results
for an unfinished query.

@tylertreat