remove empty strings at the end of the file