mongodb/node-mongodb-native — pull request #1128 by benighted (2013-11-24 02:07:14+00:00)
Title: Close db on failed connect so node can exit.

With mongod running on localhost:27017:
```
var MongoClient = require('mongodb').MongoClient;
MongoClient.connect('mongodb://localhost:27017', function (err, client) {
if (err) console.error(err);
else console.log('connect ok');
if (client) client.close();
});

MongoClient.connect('mongodb://localhost:27018', function (err, client) {
if (err) console.error(err);
else console.log('connect ok');
if (client) client.close();
});
```

Output is:
```
connect ok
[Error: failed to connect to [localhost:27018]]
```

...and the node process will not exit on its own.