Error handling when database is not opened.