Fix an fd leak that would occur in HTTP AMI sessions