Fix database open/create handling.

In special cases, don't try to create a new XML document and overwrite
the database, if it could not decrypt it.