fixes #6289: avoids concurrent downloads of files with the same name and destination dir.

We can't delete the lock file, as it's the same file as the one being downloaded/updated by wget. The gist is: we create an empty file, acquire a lock on it, start wget with a '-c' option and pass the file we just created as the download target. Once download is complete we remove the lock.