I'm really sorry for your loss. It must be a very diffucult time for you and rge family.
Immigration wise, I don't know how much you know about the process, getting Advance Parole (I-131) is not going to be fast, even with a valid reason which you definitely have.
It's going to take 4-8 weeks to get USCIS accept documentation. Maybe 3 months or so do get AP approved if you have a valid emergency reason and you bug USCIS a lot with expedite requests and inquiries.
You cannot leave the US without abandoning AOS if you don't have I-131 approved.
The bullet proof solution would be leaving the US before visa expires and going through consular processing for GC (CR-1 immigration visa). The downside of this path is separation from your spouse, though you should be able to see each other by you visiting on ESTA and spouse visiting you on US passport.
If you decide to AOS, the chances are, you will miss the funeral with nearly 99% probability, unless you abandon the process.