Twist of cholesteric liquid crystal cells: stability of helical structures and anchoring energy effects.