First, suffering is redemptive, as we are members of Christ’s Body. He suffered and therefore, we are also going to suffer. As difficult as it is to see, God is bringing good from it. Second, some of our suffering may be considered to be our purgatory here on earth. Third, your husband may very well have held on until he felt comfortable at home - He likely knew that the end of this life (the beginning of the next) was near and who wants to pass in the hospital with noise, machines and medical staff coming and going 24/7? As difficult as it is, you might try thinking of it as his unexpressed last wish.
Since he received the Sacrament of Anointing and probably the Viaticum (“food for the journey”), you need not worry about the state of his soul. He is in the best, most merciful hands there are. You, on the other hand, watched all of his suffering - feeling helpless as you did. I can tell you that watching suffering is often more difficult than it is to suffer. DW has gone through this during the past eight years of my treatment for various cancers.
You are grieving and this is a 100% natural process that has stages. You owe it to yourself to grieve properly, as God intends us to do, while being aware of the process as well as things to avoid as you grieve. You might contact your parish, or the archdiocese and inquire about help that is available for those who are mourning the loss of a loved one. Stay close to family and loved ones. Hold them tightly and cry. Suffering is redemptive, but tears are therapeutic.
Prayers are ascending.