Additional checks and descriptive error message against querying closed db