Use left="rptstart" instead of right="rptstart" so that the barline is on the correct side of the relevant measure.