Also try an a async implemention of _flush and see if it still completes
before the 'finish' event is fired:

w._flush = function(cb){
 process.nextTick(function () {
   writtenData.push('flushed');
   cb();
 }); 
};

See related discussion here:
https://github.com/joyent/node/pull/7612