Fix issues with bufferWillDispose tracking.

Now that we dispose all the modes when a buffer is hidden, we need to track
whether or not the buffer is actually going away more carefully.

We also now distinguish between the buffer going away and the view going away.