Adding checks for Disposed / Disposing

Since Dispose may be called cyclically, need to prevent a stack overflow
exception.