checkDatabase
Check if the database is open and throw an exception if it's not. This provides a more informative error message than the default UninitializedPropertyAccessException.
Throws
if the database is not open or not properly initialized.