Fix problem with ScopeManager being null.

Sometimes `ScopeManager` is not set when `EndRequest` is triggered. I found this to be the case with an Azure deployment with multiple domains and a redirect from the non-canonical domains to the canonical domains. This threw a `NullReferenceException`.

This fix has successfully been deployed to a production server.