Handle races in Dispose logic.

- Added more states and handle dispose being called at different points in time.