So, I found the solution. The problem was that boto3 of version 1.36 corrupted the file, by adding x-amz-checksum-crc32 to the end of it. I downgraded the boto3 by using pip install "boto3<1.36" and everything works fine!