remove a space at the end of the filename