How to perform the register opening and closing