diff --git a/lib/gridfs/grid_store.js b/lib/gridfs/grid_store.js index 3d51a14f1f..08e0119361 100644 --- a/lib/gridfs/grid_store.js +++ b/lib/gridfs/grid_store.js @@ -452,7 +452,9 @@ var writeFile = function(self, file, callback) { self.currentChunk = chunk; if (offset >= stats.size) { - fs.close(file); + fs.close(file, function(err) { + if (err) return callback(err); + }); self.close(function(err) { if (err) return callback(err, self); return callback(null, self);