Restore cpoptions when script finishes early