Electronic structure of titanium(III) and titanium(IV) halides studied by solid-phase X-ray photoelectron spectroscopy