close result set first.