GNU GRUB Chainloader

I’ve recently installed Ubuntu on an external SSD which I plugged in via USB. My internal SSD has Windows 10 operating as default OS. The BIOS order is set so Ubuntu boots first. When my external SSD is plugged in, at system start I can choose whether to boot and start Ubuntu or Windows Boot Manager (among other options), which then starts Windows normally. However, when the external SSD is disconnected, GNU GRUB console screen appears and I have to type the following in:

grub>chainloader (hd0,gpt1)/EFI/Microsoft/Boot/bootmgfw.efi grub>boot 

to start Windows. I changed in the BIOS the boot order so that my internal SSD boots first, but then this error appears:

System Boot Order not found, reset System

And keeps bootlooping, so I have to change the order back to Ubuntu, at least so I can type that in to boot Windows. What I want to achieve:

  1. Choose whether to boot Ubuntu or Windows Boot Manager when the external SSD is plugged in (this works so far)

  2. When the external SSD is disconnected, I want to automatically boot Windows without having to type the command above in the GNU GRUB console.

I’ve already tried reinstalling GNU GRUB, bootrec and so on.