Fix socket leak