Fix writing file to AWS error