code: function () {
      if (processes && processes.length > 0) {
          for (var i = processes.length - 1; i >= 0; i--) {
              processes[i].kill();
          }
      }
  }
docs: Q defer resolving when all processes are closed