Unless and until AZ relinquishes jurisdiction to another state, the case remains there. Your hard work and money will follow the case wherever it does.
I'm sorry to hear about your situation. Unfortunately, this is too complex and too important to be answered on a simple Q&A forum. Your best bet is to contact a lawyer in Arizona to learn how the law will treat this situation. I wish I could give you a better answer, but unfortunately I'd need a lot more details before we could figure this thing out. Good luck.
Sign up to receive a 5-part series of useful information and advice about child custody law.