commit-graph: clean up chains after flattened write