Restore cpoptions before calling finish

The user's 'cpoptions' are saved and restored when this script finishes normally, however there are some cases where this script finishes early, and where the user's 'cpoptions' are not restored beforehand.

I have signed the CLA.