Fix Exception scope and don't destroy image handles.