You should not be closing the application and reopening it for each change, since sometimes the user could scan the code and it was not sent