adding a 'open' and a 'close' event