added mode and flag support to fs.openSync