remove trailing whitespace before save