removeTrailingLineBreaks function

Remove all trailing line breaks.