Make sure all stores are closed if an error occurs with one of them.

Allows two processes trying to access the same database at the same time to
backoff and retry until the other one releases it.
Otherwise one can end up with some of the database's stores and the other one
with the rest, meaning neither can open it.

Note: It doesn't seem there's test infrastructure for adapter-specific tests.