Improve handling of MAD-X program crashes