Merge pull request #809 from Mossop/bug819454

Bug 819454: Avoid nuking module sandboxes when the application is shutting down. r=ochemeau(cherry picked from commit 03f0890b41d10c2633262a095be09a21238cd643)