Fixed the main controller
Better channel closing