Ensure that mongodb only tries to close an existent connection.