Restore locking in dns_resolver_shutdown and dns_resolver_attach
Although the struct dns_resolver.exiting member is protected by stdatomics, we actually need to wait for whole dns_resolver_shutdown() to finish before destroying the resolver object. Otherwise, there would be a data race and some fctx objects might not be destroyed yet at the time we tear down the dns_resolver object.
Closes #1149 (closed)