Open Activity Monitor in Applications > Utilities. Under the CPU tab, find the macOS installer, click on the X icon. Select the Force Quit and now the installer on your Mac should be terminated.