Surface segregation effects of erbium in GaAs growth and their implications for optical devices containing ErAs nanostructures