Remove infinite loop and avoid downloading the file if already there