Fix to open the S3 connection only once needed.