fix peer stop channel problem

Please try to fully understand this before merge it.
Thanks.