GRIM: set the result value just before closing