fixed bug of closing mongo and then querying it.