added missing close behaviour, added isOpen function