only remove empty lines at the end