stream: End writables before emitting 'end' event

There is a timing issue b/w the internal callback for ending writable
and the user callback of 'end' event because both of them are using
the same 'end' event.

So this fails:

    reader.pipe(writer);
    reader.on('end', function() {
      writer.end('Goodbye\n');  // should be failed
    });

But this succeeds:

    reader.on('end', function() {
      writer.end('Goodbye\n');  // should be failed
    });
    reader.pipe(writer);

This commit ends writables not using 'end' event.

Fixes #5603