stream: don't try to finish if buffer is not empty

If writable stream is `ended`, but is has some 0-length chunks left in `buffer` it thinks that it is actually ready to finish. Since c38ce9bc0a143141abfa638289b458ddaaac26d6 it means that `prefinish` fires, but `finish` will fire only after callbacks for all writes are called, but these 0-length writes are never made.

Two possible solutions:

 - ignore 0-length writes;
 - check if buffer is not empty.

In the first case `state.length === 0` would imply that `state.buffer.length === 0`, but it breaks code that does something with 0-length chunks in `_write`.

fixes #5715