What helped to me is removing saved Safari windows state.
To remove it:
Open Terminal app
Copy&paste this
rm /Users/ivanparfenchuk/Library/Containers/com.apple.Safari/Data/Library/Saved\ Application\ State/com.apple.Safari.savedState/windows.plist
and hit Return.
This is on macOS Big Sur. If the file isn't there, try to search for windows.plist in other places
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: