macOS Sierra introduced system wide tabs for most (but not all) apps, allowing you to merge multiple windows into a single window or separate merged windows.
With two or more windows of a supported app open, go to the Windows menu and choose “Merge All Windows.” All windows of the same app will be grouped into a single window. Each file you have open will appear as a tab inside the single window.
To separate the merged windows into stand alone windows of their own, select the merged window to make it active. Go to the Windows and click the “Move Tab to New Window” option. Click it to move the selected tab to a separate window.
This won’t separate all tabs into windows of their own, but will only separate the current tab to its own window. All remaining tabs will remain grouped into a single window unless you separate them one at a time.
Click the close button on a merged window, and it will close all tabs you have open in it.