@Override
 public TransformResult finishBundle() throws Exception {
   try {
     return underlying.finishBundle();
   } catch (Exception e) {
     threadLocal.remove();
     throw e;
   }
 }
 @Override
 public void processElement(WindowedValue<InputT> element) throws Exception {
   try {
     underlying.processElement(element);
   } catch (Exception e) {
     threadLocal.remove();
     throw e;
   }
 }