Girl almost hit by train, saved at last second