Basically, you did everything right, but since the indices of your mesh are pretty messed up, the alignment of your curves is also messed up.
However, you can use a trick to straighten everything out:

- Use the node
Extrude Mesh
with an offset of $0$. This will create additional faces.
- Split the edges of the top faces with the node
Split Edges
.
- Remove the superfluous faces created by the extrusion with the node
Delete Geometry
.
- And then you can apply the remaining nodes as before, because with this all curves have a correct orientation.
Depending on the direction of your profile curve, you may need to add the Flip Faces
node at the end to correct the direction.

Update
In your particular case, however, everything is obviously messed up, which is why the above solution doesn't work (as you yourself noted).
Therefore, you really need to correct the alignment of the curves beforehand.
To solve this you have to take the more complicated route and look more closely at the alignment of the individual segments of the curves, and then make the appropriate corrections.
In principle, you could solve part of the problem here with the node Reverse Curve
, but unfortunately this simply reverses the direction of the points.
So to actually get a correct alignment of the curves, you would have to affect the Curve Tilt, and then correct the alignment of the normals on the generated mesh.
Variant 1
(This variant would be the exact answer to your question)
With this solution, I first look at the alignment of the individual segments of the splines, and use that to decide whether or not to rotate the Curve Tilt:


All in all, however, this is rather unnecessary work, because as I could now see in your file, you wanted to do something completely different anyway.
At least it is obvious in the file that you somehow wanted to create an extruded window frame.
If that's the case, you can actually solve this much easier, and the whole question as well as this extensive answer was totally superfluous.
So here are the simple solutions to your actual problem:
Variant 2
Simple extrusion of the mesh:


Variant 3
Solid extrusion of the mesh:


Variant 4
Curve to mesh with a closed profile (Thanks to @RobinBetts):


Here is the blend file you provided, which includes all four variants. ...choose the one that suits you best:

PS: ...and please share your blend file right from the start with your next question to make it easier for the lovely people here to answer your questions. Thank you!