When creating ruled surfaces of lofted surfaces or solids with closed cross sections, ensure that the start points of the curves are in the correct positions. This example shows a ruled surface created from cross sections with misaligned start points (marked with arrows):
After using Curve start/reverse to change the start point of the square center curve, the twist is removed, as shown: