lib: Release resources if notmuch_database_open fails