The example concludes with
// Dispose of model and env model.Dispose();
These reclaim the resources associated with the model and environment. Garbage collection would reclaim these eventually, but if your program doesn't exit immediately after performing the optimization, it is best to reclaim them explicitly.
Note that all models associated with an environment must be disposed before the environment itself is disposed.