public void addCloseHook(CloseHook hook){
  if (closeHooks == null) {
    closeHooks=new ArrayList<>();
  }
  closeHooks.add(hook);
}

public void addCloseHook ( CloseHook hook ) { if ( closeHooks == null ) { closeHooks = new ArrayList < > ( ) ; } closeHooks . add ( hook ) ; }
add a close callback hook
