Two things:
First, it's real easy. The system will clean up for you when it soft
resets. So, you don't have to do anything. It's analogous to your desktop
system crashing when you have a file open. The system takes care of
cleaning up the mess and the file is no longer open.
Second, the DmOpenRef is not something that you can "recover". It is like a
FILE* - it's housekeeping. You can't recover something that's not there
anymore.
The practical upshot of this is that you don't need to worry too much about
this situation. During development, you can just reset the database back to
some known state and keep going. And your production code ain't gonna
crash, right? :-)
You should try to make sure that you always leave the db in some reasonable
state - write stuff atomically, cache as little as you can get away with,
etc. That way you can survive when the user presses the reset button in the
middle of your app.
Good luck,
George