Fixed IDisposable implementation and usage.

- Implement IDisposable interface correctly, with sealed classes where possible for simplicity.
- Add using statement around undisposed local variables.
Merge pull request #5410 from RoosterDragon/IDisposable

Disposable fixup