All perfect praise be to Allah, the Lord of the worlds. I testify that there is none worthy of worship except Allah and that Muhammad is His slave and Messenger.
The Witr prayer is one of the specific supererogatory acts of worship for which one has to make the intention before starting it.
If you doubt during the prayer whether or not you have made the intention for Witr, then in principle you did not make the intention.
Therefore, you should interrupt the prayer, as you did, and then start the payer while intending it as Witr. Or you may complete the prayer with the intention of making it a general supererogatory prayer, and then you pray the Witr prayer after it.
Ar-Rawdh reads, “If he doubts which intention he has made or doubts whether or not he has made the Takbeerat-ul-Ihraam (starting Takbeer), then he should cut off the prayer and start anew.”
All this of course applies if you are not affected with Waswasah (obsessive doubts), because if that is the case, then you must ignore these doubts, neglect them, and not pay any attention to them.
Allah knows best.