Fixed exception when reopening a replica set.
Added regression test for reopening a closed replica set.
tests; close a connection