The Rail Accident Investigation Branch has opened an investigation into an incident in Lancashire when a track worker was nearly struck by a train.