Fixed #464 NullReferenceException when browser is disposed while focused

Cherry picked commit from @Bodekaer to create PR that fixes #464