fixed db closed issue