The Holy Spirit is God’s ‘breath’, it’s the agent of His will. When we speak of God leaving us, we aren’t talking about the Holy Spirit, but rather of the Father, whose divine personage has the role of rewarding or chastising us according to the things we do.
God the Son’s ‘job’ is to forgive us should we seek Him out.
This is Christian theological doctrine and it’s both useful and sobering to be able to see how the ideas evolved over time. There is no shame or error in choosing how you want to believe in God. We’re all playing guesswork here, this is the mystery of the divine and God obviously doesn’t want us to stop questioning and seeking.
However if it’s dogma you’re seeking, than the yardstick to measure by is the Catholic Church, whose had more resources and time to think about these things than anyone else has. Naturally, you need to realize and accept the fact that a lot of these decisions and doctrines that happened over history that shaped how we understand the faith were very often done for extremely political reasons.
A brief search for publications regarding the Holy Spirit turns up surprisingly little in the way of legibility. It gives several roles, most notably guiding those who have the wish to seek out God in their hearts.
That said, it’s a near-universal position in Christian churches the world over that God’s grace is always at the behest of God, it’s not something humans can control or own. It can be withdrawn as easily as it can be granted. So any attempt to nail down a particular action or held belief that will cause God’s grace to permanently leave you is tantamount to claiming that the reverse is also true.
No, God’s reasons are the sole domain of God. We can catch glimpses, but never apprehend their totality.