Code cleanup
More complete de-initialization if the IO channel was created