Fix memory leaks introduced by changes for API freeze

Some memory leaks have slipped through during the various contortions required for the API freeze:

* The updates to `GitRepository` subscriptions introduced a bug that caused to not unsubscribe correctly from `TextBuffer`s when they were destroyed.
* The jQuery shims weren't having `cleanData` called on them when the underlying custom element was removed, causing handlers which are held by global jQuery data structures to leak.