fix CannotUnloadAppDomainException issue

Drain all the threads before shutting down appDomain.   I will need to apply the same fix on private kudu DeleteSiteSafe api.