fixed file extension and added automatic termination

Very nice script.

Fixed an issue that occurs when the file extension is more than 3 characters long (.webm for example) and added an automatic termination when all images are downloaded.

Additional suggestion: Maybe change the "|" in the folder name to "+" or something, since it won't work on Windows otherwise.