fs: make writeFileSync/appendFileSync correctly set file mode

The current fs.writeFileSync() does NOT pass options.mode to openSync(). As a result, the file mode is not set correctly.