What pre-condition had to be accomplished on the iberian peninsula before portugal and spain could unify internally as nations?