Dynamic localization of inner-shell excitations in free atomic and molecular clusters