Fix for bug 22307 - Intermittent IndexOutOfRangeException on closing connection

This fixes Xamarin bug 22307 (https://bugzilla.xamarin.com/show_bug.cgi?id=22307). When adding/removing channels in other areas of this class a lock is taken on the 'channels' variable. In one case the lock was missed, and this caused intermittent failures when removing a channel.