fix #2467: recreate database if it cannot be opened