Added check for active transaction within the `close`-method.
Added test for closing non-initialized database.