unix: guarantee write queue cb execution order in streams

The problem is that currently the canceled write callbacks
are being called before the already written callbacks, even
though they were queued after them.
I have tested it on Windows. It fails. What is the initial value of last_write_callbacks supposed to be? You cannot guarantee that the write callback will complete on the first loop iteration. As a result, you'll bail on the first while loop iteration (assuming last_write_callbacks is initialized to 0, but even then the test fails on Windows).

So, looks to me that the test is basically sending one write request, waiting until it's completed and then sendign a another one which will be canceled. This doesn't quite cover the scenario we need.