A conformational switch controlling the toxicity of the prion protein