Fix logic bug newly-introduced in writeFile in sqlfs.js
Some more logic fixes to writeFile and some logic fixes to mkdir in sqlfs.js