Fixes #14 Close channel if exception occurs