Trims trailing whitespace before save.