resolve nitpick: simplify deep nesting in query_finalize()

27 jobs for always-DO
in 5 minutes and 35 seconds and was queued for 5 seconds