A dotted grid is $6$ cells wide and $3$ cells tall. Carl places toothpicks along sides of the cells to form a closed loop that does not intersect itself, so that each of the $6$ cells in the middle row has exactly one side covered (the other cells have no restriction). In how many ways can he do this?