Added more db.close calls to repositories