potential fix for exception on shutdown.

This fixes the "object dispose on shut down"