create/close internal state