code: public static void closeUserCode(Function stub) throws Exception {
  		try {
  			stub.close();
  		} catch (Throwable t) {
  			throw new Exception("The user defined 'close()' method caused an exception: " + t.getMessage(), t);
  		}
  	}
docs: Closes the given stub using its {@link Function#close()} method. If the close call produces
  an exception, a new exception with a standard error message is created, using the encountered exception
  as its cause.
  
  @param stub The user code instance to be closed.
  
  @throws Exception Thrown, if the user code's close method produces an exception.