What’s your focus policy?
It’s highly unlikely at the point of you closing a window that if no other window has focus, this window has keyboard focus. Hence I presume you mean something like this:
DestroyModuleConfig a:*
*a: destroy_window foo
AddToFunc StartFunction I Module FvwmEvent a
DestroyFunc Foo
AddToFunc Foo
+ I None (CurrentPage, Focused) Foo2
DestroyFunc Foo2
AddToFunc Foo2 I Next (CurrentPage, !Transient, AcceptsFocus) Focus
But you don’t say why, or what it is you’re trying to do.
– Thomas Adam