title: nodejs stream finish callback after pipe is not launched
body: <p>I need to do some housekeeping after pdf file is saved:</p>
  
  <pre><code>docx2pdf(doc, function (pdf) {
      console.log("saving file");
      var pdfFile = fs.createWriteStream("./test2.pdf");
      pdf.on('finish',function(){
          console.log("Finished");
          process.exit();
      }).pipe(pdfFile);
      pdf.end();
      console.log("After save");
  }, true, true);
  </code></pre>
  
  <p>But code inside second nested function is never launched. pdf is object from pdfkit library. How can I fix it?</p>
  
  <p>UPD: this approach doesn't work also:</p>
  
  <pre><code>docx2pdf(doc, function (pdf) {
      console.log("saving file");
      var pdfFile = fs.createWriteStream("./test2.pdf");
      pdfFile.on('finish',function(){
          console.log("Finished");
          process.exit();
      });
      pdf.pipe(pdfFile);
      //pdf.end();
      console.log("After save");
  }, true, true);
  </code></pre>