I've found this thread in the Spotify community. Originally from 2019, but issue is happening to people, recently as well.
https://community.spotify.com/t5/Desktop-Windows/Spotify-Web-Player-Auto-Logs-out-After-Closing-Browser/m-p/6320442
Do more on the web, with a fast and secure browser!
Download Opera browser with:
- built-in ad blocker
- battery saver
- free VPN