Add shutdown logic to UI tests and fix inheritance issues.
Refactor startup and shutdown methods on UI tests to share same test setup methods.
Add some garbage collection to tests.