fixed bugged with already closed DB