Fixed retries in S3 when the HTTP 400 timeout is received.

This addresses #959. I'm not totally in love with it (or the tests) but it would be progress.