fix memory and socket leak in carbon output

defer functions only run at the end of the
function. if you have loop that reads from
channel and creates defer in each loop iteration
then you will leak memory for every function
it saves and the connection won't be closed
until the channel is closed which is probably
never.
Merge pull request #334 from mitadmin/fix_carbon_resource_leak

fix memory and socket leak in carbon output