Turn off automatic termination of applications that block or cancel shutdown
Using Group Policy Editor
Type gpedit.msc in start search and hit enter to open the Group Policy Editor. The Group Policy Editor is available in Windows 10 Pro, Windows 10 Enterprise, and Windows 10 Education editions only, and not in Windows 10 Home. Navigate to Computer Configuration > Administrative Templates > System > Shutdown Options. Now in the right pane, click on Turn off automatic termination of applications that block or cancel shutdown. Click on Edit policy setting. From the window that opens you can enable or disable this policy. If you enable this setting, console applications or GUI applications without visible top-level windows that block or cancel shutdown will not be automatically terminated during the shutdown. If you disable this setting, these applications will be automatically terminated during the shutdown, helping to ensure that Windows can shut down faster and more smoothly.
Using Windows Registry
You can also use the Windows Registry to achieve this. Run regedit and navigate to the following key: Right-click in the right pane, and select New > DWORD (32-bit Value), name it AllowBlockingAppsAtShutdown and give it a value of 1. Hope this helps.