X-ray Absorption Spectroscopy of Transition Metal-Magnesium Hydride Thin Films