Man comes within an inch of being killed by train