implement open and close