Refactor database handling

open and close is now handled by
the data base object by external
calls.
MockDeck will be automatic created