The term you're looking for is "goodnight ballads." The idea is that it is the criminal's "last goodnight."
Peter Bellamy used to say that it was a curious fact that no-one ever says "good night" in a goodnight ballad. He was wrong, of course. In the most common family of goodnight ballads, which includes Newry Highwayman, Flash Lad, Adieu Adieu, etc, the protagonist "shut the shutters and bade them good night." Indeed, the various versions of this ballad are so widespread that it is conceivable that the term "goodnight ballad" derives from this line.