I put my house on the market after being laid off and qualifying for unemployment, but I just got a job offer that will start before my house closes - would I still qualify for partial exclusion of gain?

We'd been living in our home for 10 months when I was suddenly laid off. Due to existing debts, my wife and I decided we couldn't afford to keep the home, so we put it on the market right away. In the meantime, I was able to quickly get a job that will start before our house sale closes. We have an accepted offer on another home out of state, and my new job is remote-only. Will I still qualify for the partial exclusion on the gain from the home (it will be significant) or will we no longer qualify because I found employment again? My wife doesn't work and takes care of our 3 kids full-time.