Resistive switching in Cr-doped SrTiO3: An X-ray absorption spectroscopy study