I think what happens is that in excess of acid, free H+ ions protonate your chlorohydrine, then Cl- attacks it and SN2 takes place, so that`s how you get X back again, as for the Z it`s obvious. What you should do is quench the reaction with some base and ice as soon as that starts to happen. Why don`t you listen to me and go via the styrene path? Also, I think your reaction temperature is way too high, that`s why elimination takes place and yield is lower due to SN2 increased possibility.