The X for a window means to close a window. If there's only one window open and you close it, Opera no longer needs to be opened, so Opera exits instead.

At the URL opera://settings/onStartup, it says "Retain tabs from previous session". When there are multiple windows opened and you close a window, the window you close and all its tabs are destroyed, which means those tabs no longer exist to retain when you finally close the last window to exit Opera.

Think of the setting as "Retain/Restore currently-opened tabs from previous session" or "Save currently-opened tabs when exiting Opera".