Raise exception for unifinished queries.

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