Perhaps the line start and end points are not exactly identical, so they don't make a closed outline when converted to polygons. You can test this by using the expression is_closed($geometry)
in the Select by Expression tool.
As a first workaround, try using the other line-to-polygon tool. (QGIS has two tools for converting lines to polygons: the native tool "Lines to polygons", and the SAGA tool "Convert lines to polygons.")
If neither tool works, proceed to fixing the non-closed outlines.
Try using the snap points to grid
tool with a very small grid size. The trick is finding the right grid size that snaps all the start and endpoints to the same grid point without noticeably changing the shape of each polygon. That may take some trial and error. The ideal grid size will probably be about half the length of the gap between the start and end points.
Another possible solution is to add a short line connecting the end point to the start point. Note that this method requires a unique building ID field for the final step. If you don't have one, create it first.
Use the Select by Expression tool to select non-closed lines with this expression:
is_closed($geometry) = false
Use the Geometry by Expression tool to create lines from the end point to the start point of the selected features (choose "selected features only), with this expression:
make_line(end_point($geometry),start_point($geometry)
Use the Merge Vector Layers tool to combine the original building outline layer with the new layer you created in the last step (be sure not to choose "selected features only" for this step)
- Use the Dissolve tool to combine the original building outlines with the new line segments, using the unique building ID field as the Dissolve field.
Once your building outlines are closed, use the Lines to Polygons tool to convert them into polygons.