Improve my previous change a bit.

Checking the `disposing` argument is cleaner.