Network Rail has been fined £3.41 million over the death of a track worker from Hampshire who was hit by a train.