Fix readonly database open