Fix: tools: Try to remove blank lines from the end of text output.
This was likely due to me calling printing function A, seeing if it
printed anything out, and then adding a blank line before calling
printing function B. This left open the possibility that if function B
didn't have anything to print, a blank line would still be added first.
Instead, delay printing the blank lines until the last possible moment.
Print them out in function B only after checking that there is anything
to be printed out.