wait_for_drain = function () {
        var keep_waiting = false;
        for (var i in self.output_streams) {
            var stream = self.output_streams[i];
            if (stream._queue) {
                if (stream._queue.length === 0) {
                    stream.end();
                } else {
                    keep_waiting = true;
                }
            } else if (stream._writeQueue) {
                if (stream._writeQueue.length === 0) {
                    stream.end();
                } else {
                    keep_waiting = true;
                }
            } else {
                continue;
            }
        }
        if (keep_waiting) {
            setTimeout(wait_for_drain, 100);
        } else {
            //Done!
            callback();
        }
    }
Waits for all output streams to drain before calling `callback`.

@param {Function} callback
@api public