fixed subtle bug in closeChannel behaviour on lock release and debug logging.