I assume when Tony Stark flashed the firmware, he was "root". Standard practice is to leave the root account alone, and do everything through a superuser account. So he would have a superuser account that he did everything through.
At some point, he transferred the "root" account to Peter.
So at the beginning of the movie, Peter has the root "password" (or rather the root biometrics since people don't use passwords any more.) Obviously he would also have a superuser account that he used to execute commands but it would be like "su -c target Brad" or something like that.
So when he said "transfer control" to Beck, he transferred the "root" account to Beck. So now Beck is "root" (ie. has the root biometrics) but he would also have a superuser account that he issued commands through.
When he got the glasses back, Peter would still have his superuser account, as evidenced when EDITH says "Welcome back, Peter" after confirming his biometrics. That's a configurable welcome message, you can see how it's done here :
So when he got them back he would just be like "su- c terminate" and that would just stop it.
Does that make sense?