Taiwan shares end down as gains eroded with tech sector in f