Force wget or curl to save files using the expected filename

Since wget will rename files if redirected to a url other than the one originally requested, add -O $filename (or -o $filename for curl) to make sure downloads are named as expected.