Move cleanup of queries to later in the shutdown sequence

to avoid TSAN report

    WARNING: ThreadSanitizer: data race
      Write of size 8 at 0x000000000001 by main thread:
        #0 free <null>
        #1 default_memfree lib/isc/mem.c:440
        #2 mem_put lib/isc/mem.c:363
        #3 isc__mem_free lib/isc/mem.c:1012
        #4 main bin/tools/mdig.c:2231

      Previous read of size 1 at 0x000000000005 by thread T1:
        #0 dns_name_fromtext lib/dns/name.c:1121
        #1 sendquery bin/tools/mdig.c:596
        #2 sendqueries bin/tools/mdig.c:779
        #3 dispatch lib/isc/task.c:1153
        #4 run lib/isc/task.c:1345
        #5 isc__trampoline_run lib/isc/trampoline.c:184
        #6 <null> <null>

      Thread T1 (running) created by main thread at:
        #0 pthread_create <null>
        #1 isc_thread_create pthreads/thread.c:79
        #2 isc_taskmgr_create lib/isc/task.c:1435
        #3 main bin/tools/mdig.c:2148

    SUMMARY: ThreadSanitizer: data race in __interceptor_free
77 jobs for !4768 with 2533-mdig-move-cleanup in 33 minutes and 49 seconds (queued for 10 seconds)
latest detached
Status Job ID Name Coverage
  Autoconf
passed #1551418
amd64 linux
autoreconf

00:00:17

 
  Precheck
passed #1551420
amd64 linux
clang-format

00:00:18

passed #1551421
amd64 linux
coccinelle

00:04:11

passed #1551422
amd64 linux
danger

00:00:16

passed #1551419
amd64 linux
misc

00:00:16

passed #1551423
amd64 linux
tarball-create

00:01:58

 
  Build
passed #1551435
amd64 linux
clang:asan

00:02:41

passed #1551439
amd64 linux
clang:buster:amd64

00:01:02

passed #1551442
amd64 libvirt
clang:freebsd11:amd64

00:01:34

passed #1551443
amd64 libvirt
clang:freebsd12:amd64

00:01:10

passed #1551444
amd64 libvirt
clang:openbsd:amd64

00:02:36

passed #1551437
amd64 linux
clang:tsan

00:01:13

passed #1551424
amd64 linux
gcc:alpine3.13:amd64

00:01:04

passed #1551434
amd64 linux
gcc:asan

00:01:31

passed #1551428
amd64 linux
gcc:buster:amd64

00:00:53

passed #1551425
amd64 linux
gcc:centos7:amd64

00:00:57

passed #1551426
amd64 linux
gcc:centos8:amd64

00:00:55

passed #1551433
amd64 linux
gcc:focal:amd64

00:01:01

passed #1551438
amd64 linux
gcc:mutexatomics

00:01:03

passed #1551430
amd64 linux
gcc:out-of-tree

00:00:56

passed #1551429
amd64 linux
gcc:sid:amd64

00:01:25

passed #1551440
amd64 linux
gcc:softhsm2.4

00:01:13

passed #1551441
amd64 linux
gcc:softhsm2.6

00:01:05

passed #1551427
amd64 linux
gcc:stretch:amd64

00:01:07

passed #1551436
amd64 linux
gcc:tsan

00:01:03

passed #1551431
amd64 linux
gcc:tumbleweed:amd64

00:00:56

passed #1551432
amd64 linux
gcc:xenial:amd64

00:01:01

passed #1551445
amd64 windows
msvc:windows:amd64

00:00:49

 
  Unit
passed #1551456
amd64 linux
unit:clang:asan

00:02:36

passed #1551460
amd64 linux
unit:clang:buster:amd64

00:01:11

passed #1551463
amd64 libvirt
unit:clang:freebsd11:amd64

00:01:56

passed #1551464
amd64 libvirt
unit:clang:freebsd12:amd64

00:01:55

passed #1551465
amd64 libvirt
unit:clang:openbsd:amd64

00:04:20

passed #1551458
amd64 linux
unit:clang:tsan

00:04:13

passed #1551446
amd64 linux
unit:gcc:alpine3.13:amd64

00:01:30

passed #1551641
amd64 linux
unit:gcc:asan

00:01:40

passed #1551450
amd64 linux
unit:gcc:buster:amd64

00:02:26

passed #1551447
amd64 linux
unit:gcc:centos7:amd64

00:01:24

passed #1551448
amd64 linux
unit:gcc:centos8:amd64

00:01:17

passed #1551454
amd64 linux
unit:gcc:focal:amd64

00:01:18

passed #1551459
amd64 linux
unit:gcc:mutexatomics

00:01:13

passed #1551451
amd64 linux
unit:gcc:sid:amd64

00:01:13

passed #1551461
amd64 linux
unit:gcc:softhsm2.4

00:01:38

passed #1551462
amd64 linux
unit:gcc:softhsm2.6

00:01:13

passed #1551449
amd64 linux
unit:gcc:stretch:amd64

00:01:25

passed #1551457
amd64 linux
unit:gcc:tsan

00:04:29

passed #1551452
amd64 linux
unit:gcc:tumbleweed:amd64

00:01:21

passed #1551453
amd64 linux
unit:gcc:xenial:amd64

00:01:13

failed #1551455
amd64 linux
unit:gcc:asan

00:02:44

 
  System
passed #1551476
amd64 linux
system:clang:asan

00:14:57

passed #1551643
amd64 linux
system:clang:buster:amd64

00:11:28

passed #1551483
amd64 libvirt
system:clang:freebsd11:amd64

00:15:44

passed #1551484
amd64 libvirt
system:clang:freebsd12:amd64

00:15:30

passed #1551478
amd64 linux
system:clang:tsan

00:16:39

passed #1551466
amd64 linux
system:gcc:alpine3.13:amd64

00:16:13

passed #1551475
amd64 linux
system:gcc:asan

00:15:09

passed #1551470
amd64 linux
system:gcc:buster:amd64

00:17:57

passed #1551467
amd64 linux
system:gcc:centos7:amd64

00:15:55

passed #1551468
amd64 linux
system:gcc:centos8:amd64

00:16:00

passed #1551474
amd64 linux
system:gcc:focal:amd64

00:16:08

passed #1551479
amd64 linux
system:gcc:mutexatomics

00:16:10

passed #1551471
amd64 linux
system:gcc:sid:amd64

00:14:30

passed #1551481
amd64 linux
system:gcc:softhsm2.4

00:14:27

passed #1551642
amd64 linux
system:gcc:softhsm2.6

00:11:50

passed #1551469
amd64 linux
system:gcc:stretch:amd64

00:16:07

passed #1551477
amd64 linux
system:gcc:tsan

00:17:42

passed #1551472
amd64 linux
system:gcc:tumbleweed:amd64

00:16:00

passed #1551473
amd64 linux
system:gcc:xenial:amd64

00:15:36

failed #1551480
amd64 linux
system:clang:buster:amd64

00:15:56

failed #1551482
amd64 linux
system:gcc:softhsm2.6

00:16:00

 
  Docs
passed #1551485
amd64 linux
docs

00:01:01

 
  Postcheck
passed #1551489
amd64 linux
cppcheck

00:00:55

passed #1551486
amd64 linux
flake8

00:00:27

passed #1551644
amd64 linux
gcov

00:00:49

76.0%
passed #1551487
amd64 linux
pylint

00:00:26

passed #1551488
amd64 linux
scan-build

00:05:14

failed #1551490
amd64 linux
gcov

00:06:03