How to get a 3D model of a closed surface

hello. everyone.

I am practicing the example in this link.

In this example, a marching cube is used to obtain a surface,
Looking at the resulting image (, the upper surface is not closed.

Please let me know how can I get a closed surface.

thank you.