wip: added state and close methods