Fixes #3 Redirects break write

Tries up to 3 times to perform the task (the retry counter might be overkill, I've only seen it redirect once)