done (err, cursor) {
                    // in case runtime faced an error during run, we do not process any other event and emit `done`.
                    // we do it this way since, an error in `done` callback would have anyway skipped any intermediate
                    // events or callbacks
                    if (err) {
                        emitter.emit('done', err, emitter.summary);
                        callback(err, emitter.summary);

                        return;
                    }

                    // we emit a `beforeDone` event so that reporters and other such addons can do computation before
                    // the run is marked as done
                    emitter.emit('beforeDone', null, {
                        cursor: cursor,
                        summary: emitter.summary
                    });

                    _.forEach(['environment', 'globals', 'collection', 'cookie-jar'], function (item) {
                        // fetch the path name from options if one is provided
                        var path = _.get(options, _.camelCase(`export-${item}`));

                        // if the options have an export path, then add the item to export queue
                        path && emitter.exports.push({
                            name: item,
                            default: `newman-${item}.json`,
                            path: path,
                            content: item === 'cookie-jar' ?
                                cookieJar.toJSON() :
                                _(emitter.summary[item].toJSON())
                                    .defaults({
                                        name: item
                                    })
                                    .merge({
                                        _postman_variable_scope: item,
                                        _postman_exported_at: (new Date()).toISOString(),
                                        _postman_exported_using: util.userAgent
                                    })
                                    .value()
                        });
                    });

                    asyncEach(emitter.exports, exportFile, function (err) {
                        // we now trigger actual done event which we had overridden
                        emitter.emit('done', err, emitter.summary);
                        callback(err, emitter.summary);
                    });
                }
Custom callback to override the `done` event to fire the end callback.

@todo Do some memory cleanup here?
@param {?Error} err - An error instance / null passed from the done event handler.
@param {Object} cursor - The run instance cursor.
@returns {*}