in reply to Easy if you don't mind slurping.
in thread truncate only a last blank line

Neat.

And you can shorten that some:

perl -pi.bak -0777e's{ ^ \n \z }{}xms' *.txt

Makeshifts last the longest.