TSDB: Extract parts out of populateSeries (#6983)
TSDB: Extract parts out of populateSeries (#6983)

This addresses fabxc's TODO.

More importantly, it now properly defers the
querier.Close(). Previously, if a panic happened after creation of the
querier within the populateSeries function, querier.Close() was never called.

The latter was responsible for #6977.

Signed-off-by: beorn7 <91e32ae1d26bd312b370cf8378a5a83accca90a0@grafana.com>
kangwoo/prometheus,keegancsmith/prometheus,keegancsmith/prometheus,kangwoo/prometheus,alileza/prometheus,prometheus/prometheus,GoogleCloudPlatform/prometheus,prometheus/prometheus,GoogleCloudPlatform/prometheus,Gouthamve/prometheus,keegancsmith/prometheus,GoogleCloudPlatform/prometheus,alileza/prometheus,prometheus/prometheus,keegancsmith/prometheus,alileza/prometheus,alileza/prometheus,Gouthamve/prometheus,kangwoo/prometheus,prometheus/prometheus,kangwoo/prometheus,GoogleCloudPlatform/prometheus,keegancsmith/prometheus,Gouthamve/prometheus,alileza/prometheus,prometheus/prometheus,Gouthamve/prometheus,GoogleCloudPlatform/prometheus