Localized 5f2 States in UPd5Al2 and Valence Crossover in the Vicinity of Heavy-Fermion Superconductivity