workaround for onClose and open PORT