fs: create callback before nullCheck call
Checklist
-
tests and code linting passes -
the commit message follows commit guidelines
Affected core subsystem(s)
fs
Description of change
The callback function creation should happen before the nullCheck
,
because it might invoke the callback to indicate errors.
This was pointed out by @cjihrig, in https://github.com/nodejs/node/pull/7068#discussion_r65582102
cc @nodejs/fs