As the phone and the computer where you see the script are two separate devices, they’re not connected in such a way that one can control the other.
You need to hang up on both the devices, the phone and the platform, using the “hang up” button presented on the interface.