In past versions of Windows 10, WSL could be exited by closing all active terminals but with the introduction of background tasks in WSL this no longer works. Is there a way to exit WSL without rebooting the host system?
As the other answers mention, specifically for windows 1803, the following should work from powershell or cmd:
net stop LxssManager
As highlighted by @Ramhound, only for newer versions, which have wsl 2, you can also run this from powershell or cmd:
shutdown all instances:
shutdown a specific instance (e.g. Ubuntu):
wsl.exe -t Ubuntu
to show the current list of instances: