Ensure that inline widgets only have onClosed() called once

For #4107.

Also centralized the close logic in `_removeInlineWidgetInternal()` and made sure everyone bottlenecks through that. This looks safe because all the existing calls to `_removeInlineWidgetInternal()` already called `onClosed()`, and the one place where we were calling `onClosed()` by itself wouldn't be harmed by doing the other stuff that's in `_removeInlineWidgetInternal()` (which is just cleaning up the widget from our internal array).