fixed db.close()