When a papal candidate is elected by a conclave, even if invalidly, he becomes the valid Roman Pontiff when he is accepted by the body of Bishops as the Roman Pontiff. For the authority to elect successors of Peter resides in the body of Bishops, even when it is exercised by the Cardinals (as their representatives).
Once a man is a valid Pope, he is always valid, until death or resignation. He cannot become invalid by teaching something you disagree with. He cannot commit apostasy, heresy, or schism, due to the gift of a never-failing faith given to him by the prevenient grace of God. He cannot teach any grave error, nor enact any grave error in discipline, for the same reason.
Pope Francis was accepted by the body of Bishops as the Roman Pontiff, so he necessarily remains a valid Pope until death or resignation.