You should enable "Depth Test".
So all you have to do is just to add one line.
viewer.scene.globe.depthTestAgainstTerrain = true;