Theory of the thickness dependence of the charge density wave transition in 1T-TiTe 2