Rabbi Avraham Ibn Ezra (and similarly other medieval commentators) maintained that throughout the Torah there are verses which, like the final verses of Devarim, were written after Moshe's death, either by Yehoshua or by one of the other prophets. Rabbi Yosef ben Eliezer explains that this in no way contradicts our faith, since the entire text was written through prophecy, and it therefore makes no difference whether a certain verse was written by Moshe or by a different prophet.

It would seem, therefore, that according to the Ibn Ezra, the Torah was not given as a fixed text with no possibility of future additions. Even after the Torah was completed by Moshe, it was still open to some limited degree, and in instances where it was of great importance to add certain comments into the text, as clarification or to add depth of meaning, the prophets were not prevented from introducing them.

Courtesy of the Virtual Beit Midrash, Yeshivat Har Etzion