The Prophet ﷺ said, "The night prayer is to be performed in pairs of two. When you fear the approach of dawn, pray one rakah as witr, and let the last of your prayers be witr."
حدثنا قتيبة حدثنا الليث عن نافع
عن النبي ﷺ أنه قال صلاة الليل مثنى مثنى فإذا خفت الصبح فأوتر بواحدة واجعل آخر صلاتك وترا
Its isnad is sahih. Nasai also narrated it (3/227, 228, no. 1672, Qiyam al-Layl, Chapter on How the Night Prayer is Performed) from Qutayba with the same wording. Bukhari also narrated it (nos. 472, 990) and Muslim (no. 751) from the hadith of Nafi with the same wording.There is also a narration on this subject from Amr bin Abasa [Ahmad 4/387].