Remove after the first point of the filename instead of the last one.

The handles the case the extension of the file is a combination like tar.gz