added closing logics