In order to find the passage you're seeking, I did a Google search for [ Rambam | Maimonides punishment God closes the gate of teshuvah ]. Baruch Hashem, I found something.
The first bit of Hilchos Teshuvah 4:2 begins:
ומהן חמשה דברים הנועלים דרכי התשובה בפני עושיהן ואלו הן
Dr. Henry Abramson translates:
And among them are five things that close the doors to the ways of teshuvah, and these are they
Rabbi Eliyahu Touger translates similarly:
Among [the 24] are five deeds which cause the paths of Teshuvah to be locked before those who commit them. They are:
You may view the full Hebrew text of the chapter, plus Rabbi Touger's translation, on Chabad's website.
Comforting postscript
Section 4:6, at the very end of the chapter, adds:
All of the above, and other similar transgressions, though they hold back repentance, they do not prevent it entirely. Should one of these people repent, he is a Baal-Teshuvah and has a portion in the world to come.