fixes and more contour detection

Fixed some windows closing, found countor with largest area