Tech shares tumble to end losing week for US stocks