Make sure all stores are closed if an error occurs with one of them.
Allows two processes trying to access the same database and 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.