Close the template

Menu.buildFromTemplate modifies it so copy before hand
so it can be reused
Store each window's menu template

Restore it when the window gains focus
Compare templates before swapping them out