Issue with the post-grasp motion in gazebo

There is something strange in gazebo 7.12.0, when I am running a grasping of an object. It all worked fine until it grasped the object. Once it grasped it, when I do some motion with the arm, the gripper is opening and closing due to some unknown reason. I am confused how to fix it, I tried changing the PID gains, mass of the links, collision mesh and many more, but I am unable to solve the issue. I see that joint efforts show strange behavior. Any idea how to solve this?.