If you have used gap elements in your railway, you will need to connect them before you can save it as a .rly file. This is done using the "Connect Gaps" tool.
The tool will highlight one gap element and the user will need to click on the corresponding gap element. This will continue until all gap elements are connected.