Exit with failure when an error occured while connecting to mongod.

This avoids the exeption being caught and ignored, letting the process
hang in an unusable state.