Pedro Sanchez stays on as Spain’s prime minister after weighing exit