So, can a pope be an open heretic? I think that kind of defeats the purpose of head of the Church, but what do I know?
Saint Robert Bellarmine has some interesting thoughts...
Saint Robert Bellarmine, De Romano Pontifice, Book IVChapter VI: On the Pope as a Particular Person
The fourth proposition. It is probable and may piously be believed that not only as ‘Pope’ can the Supreme Pontiff not err, but he cannot be a heretic even as a particular person by pertinaciously believing something false against the faith.
It is proved:
1) because it seems to require the sweet disposition of the providence of God. For the Pope not only should not, but cannot preach heresy, but rather should always preach the truth. He will certainly do that, since the Lord commanded him to confirm his brethren, and for that reason added: “I have prayed for thee, that thy faith shall not fail,” that is, that at least the preaching of the true faith shall not fail in thy throne. How, I ask, will a heretical Pope confirm the brethren in faith and always preach the true faith? Certainly God can wrench the confession of the true faith out of the heart of a heretic just as he placed the words in the mouth of Balaam’s ass. Still, this will be a great violence, and not in keeping with the providence of God that sweetly disposes all things.
2) It is proved ab eventu. For to this point no [Pontiff] has been a heretic, or certainly it cannot be proven that any of them were heretics; therefore it is a sign that such a thing cannot be.