“cmd.abort” abruptly terminates execution of the PyMOL command script without executing any additional commands.
def abort():
abort