从S3下载使用readfile - 在readfile之后继续缓冲

I have a pretty simple script to force downloads from S3.

$headers = $this->s3->getObjectHeaders(array('Bucket' => $bucket, 'Key' => $s3name));
    $headerArray = $headers->toArray();

    // force download in this case
    header("Content-disposition: attachment; filename=\"{$filename}\"");

    if (ob_get_level()) {
      ob_end_flush();
    }

    flush();

    readfile("s3://{$bucket}/{$s3name}"); 
    exit;
    return;

If I remove the "exit", the resulting downloaded file contains extra content at the end.

In the case of a JSON file, it adds {}.

If there was a bug AFTER readfile, the HTML error content of the bug is APPENDED to the downloaded file.

I can STOP this unwanted action by simply adding exit. BUT, this prevents me from doing any more processing at that point.

I've tried ob_end_flush(), etc, but to no avail.

Any ideas?