Q: Some of our wall mount rails return back to the wall where they terminate but may not actually touch. Is there a code requirement for end-capping if the space between the wall and the end of the return is past a certain point?
A: The codes state that a rail must “return to” the wall, the floor or itself. The key word in this is “to”. Some inspectors have interpreted “return to the wall” to mean that the handrail must make physical contact. In their opinions, if there is a gap between the wall and handrail (which is how most fabricators do it), that would be considered a return “toward” the wall.
So, to answer your original question, there is no specific code that relates to capping the end of the pipe/tube. However, if the gap is too large and an inspector is concerned that there is a risk of someone injuring themselves as a result of the opening, they may choose to reject simply because it creates an unsafe condition.
You will need to check with your local authority having jurisdiction to confirm how they interpret the code in your application. In the end, your safe bet in all applications is to make physical contact with the wall.