Voted to close a question based on "lack of minimal understanding".
Later realized the question was a duplicate.
How to I change vote to mark as duplicate instead?
You can't. A close vote once cast can only be retracted. It cannot be cast again on the same question.
Instead, just leave a comment linking to the duplicate. Others who see the question will evaluate it and close it (probably) with the correct close reason, whichever it may be.
Short (tl;dr) Answer
I recently had a similar (perhaps exactly the same) situation happen to me. More specifically, I was the fifth and deciding vote on a question. I voted the wrong way; I later flagged the question for moderator attention and tried to explain the situation clearly.
Some days later, the question close reason was changed from the incorrect "lack of minimal understanding" reason to the correct "duplicate" reason. This was done by a nice (diamond) moderator.
Your mileage may vary, and you should take care not to abuse flags.
More Background
As I said above, I was the fifth and deciding vote on a question. Two votes had been cast as duplicate. The other two were for "lack of understanding".
My first thought was to take a look at the duplicate question to see if there was a match. Given the poor quality of the question I was voting on as well as the rather specific nature of the possible duplicate, I thought that there was no way that it could be a duplicate. Besides, there was already an accepted answer on the question that I was voting on. I voted to close as "lack of understanding".
Some time later I revisited the question and noticed that the accepted answer actually had a link pointing to what would have been the duplicate question. So that's when I flagged the question. The rest of the story is described in the first section above.