Added retry mechanism for S3 connection errors

Closes #95

(cherry picked from commit 11f4e9c)