Fix crash if +closeDatabase is called before database is ever opened (fix #79)