Ok, that does seem to mean the extension is closed before it reaches that point, which is weird, but I suppose I can work around it, as it's not the saving that's wrong, it's the asking the extension's UI to show the locally saved values that's failing.