By default Windows will download and install updates on your computer without any required interaction. This is great, but the problem is that it will also reboot on its own, closing anything you may have been in the middle of working on. No idea why Microsoft approved of this terrible user experience, but fortunately there is a (very hidden) way of preventing it from happening.
First from the start menu, search and open “gpedit.msc”. Then in the application go to Computer Configuration -> Administrative Templates -> Windows Components -> Windows Update. Then select the option “No auto-restart with logged on users for scheduled automatic updates installations”, then click “Enable”, and then “Apply”.
This will ensure that your Windows 10 machine will only restart when you want it to.