Added methods to open and close the database