The "Retain tabs from previous session" startup option at the URL opera://settings/onStartup saves all opened windows and tabs when you exit Opera and then restores all those opened windows and tabs when you start Opera back up. But, if you're closing windows before you exit Opera, those closed windows can't be saved when you exit Opera because they're gone (you closed them).

The X for a window only means "exit" if there's only one window. If there's more than one window the X for each window means "close this window and wipe it out".

If you want to exit Opera without closing any windows so that they're all restored, don't close any windows. Instead, click the menu button (Opera logo) at the top left and choose "exit".

When there is a popup in new window and you close "main" window(where you have gazzilion tabs) first and later popup window,

Yeah, you can't do that. The main window needs to be open when you exit Opera. In fact, all the windows you want saved need to be open when you exit Opera.

I don't need it myself, I personally wouldn't be bother by an option to name a window and then have an "always save and restore window [name]" startup option of some sort.

Are there any other browsers that work as you expect?