Log2File: force flushing all logs on exit (and crash)

Rewritten log2file to use fs.open/fs.write instead of fs.createWriteStream,
so we can force fsync when the application is crashing.