There are a couple of user-made options which will automatically save the open windows/tabs into a layout every few minutes:
We're thinking about building something similar into Opus. Although, IMO, if the computer is crashing often enough that re-opening a few folders is a problem, something bigger needs fixing.
That's a good solution if you just want a quick button to click to manually save the current windows, or to save them when doing other actions.
The second line with D:\
on it suggests the button's primary purpose is to navigate to D:\, and it's saving the layout first. If you want the layout to be saved every time you change folders, using the OnBeforeFolderChange or OnAfterFolderChange script event would be better, as it would work automatically for all folder changes, without having to edit all your buttons and other methods of changing folders.