title: Close stream node.js
body: <p>I am not able to close a stream in node.js this is my code</p>
  
  <pre><code>        var inp = fs.createReadStream("a/b/c/"+ Name);
          var out = fs.createWriteStream("a/b/c/"+ Name);
          inp.pipe(out);
              inp.close( function(err){
                if (err){
                  console.log(err);
                } else {
                inp.unpipe(out);
                socket.emit('Done',{'Name':name});
                console.log('There will be no more data.');
                }
              });
  </code></pre>
  
  <p>Then i have this function further down in my code that deletes the directory the directory of inp</p>
  
  <pre><code>var fse = require("fs-extra");
  fse.emptyDir("a/b/c/", function(err){
    if(err){
      console.log(err);
    } else {
      console.log("doneaaaa")
      fse.remove("a/b/c",function(err){
        if(err){
          console.log(err);
        } else {
          console.log('doneaswell');
        }
      });
    }
  });
  </code></pre>
  
  <p>and i get this error !!</p>
  
  <pre><code>doneaaaa
  { [Error: EBUSY: resource busy or locked, unlink 'a/b/c/.nfs000000002ab5000d00000072']
    errno: -16,
    code: 'EBUSY',
    syscall: 'unlink',
    path: 'a/b/c/.nfs000000002ab5000d00000072' }
  </code></pre>
  
  <p>Which means the stream is still open ! </p>
  
  <p>.nfs file is created while streaming right , but shouldn't file delete once the stream is closed ?</p>
  
  <p>What am I doing wrong ?</p>