[DomCrawler] Keep temporary file copy file extensions

Follows on from the accidentally-deleted #6777

I've changed it as per @fabpot's suggestion so that the filename is random, but the extension (if present) is kept.