You can save the window configuration of the selected frame in a register, or even the configuration of all windows in all frames, and restore the configuration later. See Convenience Features for Window Handling, for information about window configurations.
Save the state of all frames, including all their windows (a.k.a.
frameset), in register r (
Use C-x r j r to restore a window or frame configuration. This is the same command used to restore a cursor position. When you restore a frame configuration, any existing frames not included in the configuration become invisible. If you wish to delete these frames instead, use C-u C-x r j r.