Improved channel closing and added broken line detection