Add helper method for gracefully stopping external programs

Change-Id: I781e295596bd908c913184a4074f34b1f31c8836
Reviewed-on: http://review.couchbase.org/32308
Reviewed-by: Filipe David Borba Manana <fdmanana@gmail.com>
Tested-by: Filipe David Borba Manana <fdmanana@gmail.com>