fix db closure