The UK's biggest train factory that has been saved from closure