Replacing process.nextTick with setImmediate

This will solve Maximum call stack size exceeded error when dealing with large files.