Chapter 2 listings: add newlines to last line where missing