Apply custom webview changes to OSX branch

It is safer to set the controller to nil after release, as some of the other methods check it. E.g. it is possible that the user presses "cancel" right after the internal dismissal of the dialog, which will case a crash in the cancel handler below. This was an issue from before, but as we are editing the code, we may fix it.