fixed a bug where internal connections to a database are never closed