- Close issue #374 - take a lock when checking channel state / writing