Pass CloseState and ContinueState into close_if_idle function.