The Shulhan Aruch (O.H. 282:7) writes that if, during the reading of the Torah of Shaharit of Shabbat, one skipped a verse, one must go back and read that verse as well as two more verses, even if the congregation has already prayed Musaf. The Mishna Berura (ibid:35) adds that even if one skipped one word, one would need to go back and reread that part of the Parasha. Rabbi Yishmael HaKohen of Egypt (Zera Emet, vol. II, Yore De’ah, 128) writes that if one erred on one solitary letter, such as saying “Et” instead of “El”, one would have to go back and reread that portion of the Parasha.
There is discussion regarding a situation in which at least three verses are read in the seventh Aliya and then something is found which invalidates that Sefer Torah. On one hand, when the invalidation is found, the Torah has to be put away and therefore the Parasha cannot be read in its entirety so perhaps a new scroll should be taken out. On the other hand, at least three verses were read in the last Aliya and perhaps that is sufficient to satisfy the obligation to read the Torah. The HIDA (Birke Yosef 282:10), quoting Rabbi Haim Benveniste (Knesset Hagedola), rules like the latter opinion and says that another Sefer Torah does not have to be taken out to complete the seventh Aliya. Rather, the Oleh for the seventh Aliya does not recite the after-blessing of the Torah and the Maftir does not recite either the beginning or after-blessing for his Aliya. The blessings before and after the Haftara, according to this opinion are recited however.
The HIDA goes on to write that the Halacha does not follow the opinion of the Kneset Hagedola. Rather, he writes, the custom in Jerusalem was to take out another Sefer Torah even if there was only one verse left to be read in the invalid one and there would not be an issue with a blessing in vain for the new Torah. Rabbi Ovadia Yosef (Hazon Ovadia, vol. II, pg. 320) concurs with this opinion. Rabbi Ben Zion Abba Shaul (Or LeZion, vol. II, pg. 45, 52) , on the other hand, says that the custom is not like the HIDA’s opinion and that one need not take out a new Sefer Torah. Nevertheless, the widespread custom is to follow the HIDA’s approach and not that of the Knesset Hagedola.
Summary: If an invalidating issue is found when the seventh Aliya is being read, a new Sefer Torah should be taken out, regardless of how much is left to read.