title: Callback was already called
body: <p>When I try to use list.forEach method in async.waterfall in node.js, I've got the error message: 
  if (fn === null) throw new Error("Callback was already called.");</p>
  
  <p>Error: Callback was already called.</p>
  
  <p>What I want is to do some changes to every files in a directory.</p>
  
  <pre><code>/**
   * Created by slow_time on 2017/3/22.
   */
  var fs = require('fs');
  var async = require('async');
  var _dir = './data/';
  //writeStream is used to log something
  var writeStream = fs.createWriteStream('log.txt',
      {
          'flags': 'a',
          'encoding': 'utf8',
          'mode': 0666
      });
  
  try {
      //use the method waterfall
      async.waterfall([
          //read the directory
          function (callback) {
              fs.readdir(_dir, function (err, files) {
                  callback(err, files);
              });
          },
          function (files, callback) {
              //Here is what I guess, something wrong with it
              files.forEach(function (name) {
                  callback(null, name);
              });
          },
          //The code below is right, I think.
          function (file, callback) {
              fs.stat(_dir + file, function (err, stats) {
                  if(stats.isFile())
                      callback(err, stats, file);
              });
          },
          //judge whether it is a file or a directory
          function (stats, file, callback) {
              fs.readFile(_dir + file, 'utf8', function (err, data) {
                  callback(err, file, data);
              });
          },
          // do some changes to the file content
          function (file, data, callback) {
              var adjData = data.replace(/somecompany\.com/g, 'burningbird.net');
              fs.writeFile(_dir + file, adjData, function (err) {
                  callback(err, file);
              });
          },
          //write the changes back to the file
          function (file, callback) {
              writeStream.write('changed ' + file + '\n', 'utf8', function (err) {
                  callback(err, file);
              });
          }
      ], function (err, result) {
          if(err) throw err;
          console.log('modified ' + result);
      });
  } catch(err) {
      console.log(err);
  }
  </code></pre>