How can I merge the last elements of an Array that fits a curve?
The first-last merge is being requested before the array is deformed: at that stage the first and last are nowhere near each other..
It may not be ideal for you, but in this case you could do the rotation in the array, by using an object-offset, target: say an empty, rotated by (360/sides) in Z. Then the merge works.

This example has a bevel-by-angle modifier after the array.
Edit: Since this answer, the Weld modifier has become available, and can be used to stitch vertices together in this, and other situations.