Government contracts have clauses allowing termination at their discretion.
Even if the contracts were not able to be terminated legaly, it would be cheaper just to go ahead and cancel the whole project, (including the already finished parts) and pay off the contractors and the lease to the railroad company with their expected profit on the job.