Unable to close IDatabase

I found a fix. I have to manually set all the references to NULL. (or make sure they run out of scope) It doesn’t seem like Close() actually does anything when I call it. Even if pLitCiterDB is the last reference, calling pLitCiterDB->Close() doesn’t close it.