Function to handle trailing whitespace.