I clipped a big DEM to a smaller one to reduce the DEM to the area I need. Now i want to show the different heights in different colors. I did the contour lines. Due to the clipping, the contour lines will give me, using the process of "Line to Polygon", some polygons which have a flat side. I know this is because the contour lines are not closed. So how do i close them without doing it by hand following the boundaries of my clipping mask?
If you want to visualize different heights in different colors, I suggest that you don't use countour lines but instead apply a raster style with "single-band pseudo-colors" (you can then chose continuous or discrete color classes), see Certain Color for Value Range for a more detailed answer.
As a remark, if you have the clipping mask boundaries, you can merge it ( Merging multiple vector layers to one layer using QGIS?) with your contour lines before running the line to polygon tool.