You need to add codes to logout all users in the script after the code to change the profile. This will ensure that the new profile applies to all users.
Try this code:
/ip hotspot active remove
Insert it in the script you are using to change the profile, below all other codes.