All perfect praise be to Allaah, The Lord of the Worlds. I testify that there is none worthy of worship except Allaah, and that Muhammad, sallallaahu ‘alayhi wa sallam, is His slave and Messenger.
In such a case, you should perform the Maghrib prayer with the intention of offering it at its time and not of making up for missed prayers as Qadhaa' is performed after the end of a prayer's due time. The time of the Maghrib prayer in this case was not over yet, as it is extended from the Maghrib Athaan until dawn (i.e. Fajr time) for a traveler who intended to perform it in a deferred combination of prayers.