A coil will only turn on or off when its rung is run in the program.
If a coil only appears in a specific subroutine and you stop running that subroutine, the rung will not be scanned and the coil will not turn on or off.
If you are simply using a subroutine to organize your program, then it is best practice NOT to put any contacts in the rung that calls the subroutine from your main program. That way your coils will always turn on and off since the subroutine will always run every scan.
If you want to have logic controlling whether your subroutine runs, you need to have a set of mutually excusive subroutines than cover every logical state of the contacts controlling whether or not the subroutines are being run. Each subroutine then needs to have logic controlling the same coils. This ensures that one of the subroutines will always be run, and the coils will always have code controlling them each scan. eg. subroutine 1 runs when a contact X1 is true, subroutine 2 runs when contact X1 is false - each subroutine contains different code controlling for turning on and off coil Y1. In each case you will never be left with "hanging" coils stuck in the last state you left them in.