What’s Up With the Ending?

The Book of Ezra ends with another long list. But right before that, Ezra wages his successful war against mixed marriages. In the eyes of the books' authors, this is totally necessary because they want to see Israel purged of foreign influence, free to obey God's laws without the threat of falling back into idolatry. It has something to do with the religious-revolutionary message of the book, its attempt to create an ideal society comprised of a perfectly obedient citizenry.

Nehemiah ends on a very similar note. Nehemiah, after going through various reforms he helped promote, describes how he also helped break up mixed marriages with foreign women after the people started backsliding again. This solidifies the book's central idea that it's crucial for the Israelites to maintain their identity in order to remain faithful to their God. They can't make compromises with the society surrounding them, since those societies remain committed to the idolatry that got them into trouble with God in the first place. The Israelites have had a nasty habit of worshipping the gods of the nations that surround them, so the endings of these books essentially say that this is so over.