Synchronous channel closure

Fixes #31 wherein a channel is closed while reading frames and waiting for the synchronous callback to be executed.