Remove duplicate file extensions.

Gracefully remove duplicate file extensions on the output filename

Change-Id: Id4f8b0d75b587c238c89d6ca7a06fab6a57cd627
Merge "Remove duplicate file extensions."