How do you put the close() in the writeBuffer callback?
This question relates to: Problem with MongoDB GridFS Saving Files with Node.JS
A simple example is
https://github.com/mongodb/node-mongodb-native/blob/master/test/gridstore/grid_store_test.js#L97
Also check the docs for changes in behavior, writeBuffer was removed so just use write.