If GRRM has a lot of say in it, pretty sure the way he would write for Arya dying is for Jamie to kill her while she's disguised as Cercei.
Show a scene where you're focused on all of the characters, Kings Landing under attack by Danny and John, Cercei is about to give a command to blow up kings landing like the Mad King, and you think Jamie saves the day by killing her. Instead the scene splits into Cercei actually finishing the command, then Jamie turns Cercei over to discover it's actually Arya (you realize the timing was off at that point). Kings Landing blows up killing everybody of any importance except Dany since fire does not kill a dragon. She looks at the ashes of kings landing wondering if it was all worth it.
It won't be that, but it might tidy things up a bit.
Show a scene where you're focused on all of the characters, Kings Landing under attack by Danny and John, Cercei is about to give a command to blow up kings landing like the Mad King, and you think Jamie saves the day by killing her. Instead the scene splits into Cercei actually finishing the command, then Jamie turns Cercei over to discover it's actually Arya (you realize the timing was off at that point). Kings Landing blows up killing everybody of any importance except Dany since fire does not kill a dragon. She looks at the ashes of kings landing wondering if it was all worth it.
It won't be that, but it might tidy things up a bit.