background.js: Fix infinite loop in updateWindowList

Also, ask for refresh in more appropriate places.