First-principles study of topologically protected vortices and ferroelectric domain walls in hexagonal YGaO3