Actually we have even more: https://github.com/geany/geany/pull/2114 saves the session when files are opened and closed, merged in 2019 and released with 1.37.
This is probably pretty close to what the OP might have requested (it's hard to guess from the description...).