Temperature-induced valence transition and associated lattice collapse in samarium fulleride