Anharmonic stabilization of ferrielectricity in CuInP2Se6