remove all trailing blank lines and all trailing whitespace