Fixed an issue with closing channel on free buffer