fix close db bug