Close connection and process data in IIS

Hi,

I have a problem with closing a client connection on PHP side under a IIS server.
This is my method which have to close the connection with a JSON response:

public function jsonResponseAndContinueProcessing(array $data): Request
    {
        header('Connection: close');
        header('Content-type: application/json; charset=utf-8');

        ignore_user_abort(true);
        set_time_limit(0);

        ob_start();

        echo json_encode($data);

        header("Content-Length: ".ob_get_length());

        ob_end_flush();
        ob_flush();
        flush();

        return $this;
    }

And this is my simple test script:

sleep(4);

$request->jsonResponseAndContinueProcessing([
    "test" => "Mario"
]);

sleep(4);

echo ">>> !!! THAT DOESN'T BELONG IN THE RESPONSE !!! <<<";

Test 1 - Server started via PHP CGI

php -S localhost:4000

Test 1 works perfect how expected :innocent:
After 4s the connection has beed closed and the response on Javascript-side on client is how expected
{"test":"Mario"}

Test 2 - PHP Environment on IIS (v7.5) :sleepy:

Only after 8 seconds the client gets the following answer
{"test":"Mario"}>>> !!! THAT DOESN'T BELONG IN THE RESPONSE !!! <<<

Is there anyone with IIS experience?
What I have to configure in my IIS that my connection closeheader will send correct?

Best regards,
Mario