Your GUI tool is probably running apt under the hood. You can find the PID of the apt process and do something like this:
waitpid <pid> && poweroff
If you are afraid it has something to do after the apt process dies, you can add some additional arbitrary delay like this:
waitpid <pid> && sleep <seconds> && poweroff
