Added I/O channels clean up using  weak references + Unit tests