add state passing to close & next