Structural dynamics and energetics underlying allosteric inactivation of the cannabinoid receptor CB1