Try sending a SeverControl message to the /gazebo/server/control topic where the message has "stop" set to true.