closing gripper only when necessary