stream: call write's callback before end's callback

Since commit joyent/node@049903e an end callback could be called before a write callback, if end() is called before the write is done. This patch makes sure write's callback is called before end's callback.

This patch should fix the issue discussed in felixge/node-formidable#209.