I'm not sure I'd argue that AGT was necessarily better written. It's certainly clever, but it kind of bugs me that the finale of the show showcases Picard at the expense of the other characters and features a largely reset-button ending.
It's a finale that certainly fits the show, in ways both good and bad. If the Pah Wraith thing had been handled better, I think I would not hesitate to call WYLB the better finale, though, but mostly because DS9 had gone so much further as a saga by that point than TNG ever really did.
The Pah Wraith business is enough of a misstep that one can certainly hesitate, I think. But, personally, I enjoy WYLB significantly more.