Identifying layer switching in magnetic multilayers with x-ray resonant magnetic scattering