Strip trailing spaces on write