title: writeFile does not create file
body: <p>Error code looks like:</p>
  
  <pre><code>{ Error: ENOENT: no such file or directory, open 'sad' errno: -2, code: 'ENOENT', syscall: 'open', path: 'sad' }
  </code></pre>
  
  <p>where 'sad' is the name of file I would like to write to and it doesn't exist.</p>
  
  <p>Code looks like this:</p>
  
  <pre><code>fs.writeFile(filename, JSON_string, { flag: 'w' }, function(err){           
          if(err){
              return console.error(err);
          }           
          return JSON_string;
      });
  </code></pre>
  
  <p>There are other similar questions, but they are all wrong in their path, starting or not starting with /, I just want to write a file on root from where I run this node.js application (it is also initialized with npm in this directory..).</p>
  
  <p>Running with</p>
  
  <pre><code>sudo node server4.js
  </code></pre>
  
  <p>Doesnt work either.
  Changing flags to w+ or wx or whatever, doesn't help.
  Code works if file exists.</p>
  
  <p>Node v9+.</p>
  
  <p>I need to use writeFile() function.</p>