fix db connection close bug