Bug 837539 - Fix crashes due to premature deinitialization. r=rjesup,bgirard a=lsblakk
Backout of 640b31a66dfe due to regression. [r=me] [a=bbajaj]