Better database query error handling.

When returning due to an error, close the rows object.  Additionally,
when rows.Next returns false, check if it was caused by an error.
Doesn't need to, but if there are no rows, rows.Next will just return false.