Fix browser close detection regression