Extract window settings saving to a separate function.