Creating a header of matched catalogs

I used the function match_to_catalog_sky to match two catalogs. I want to save the new matched catalog with the headers of the 2 catalogs plus the match_id and match_d2d columns. The matching is done :

#Finds the closest DR12 source for each Fermi source
idx, d2d, d3d = fermi_choord.match_to_catalog_sky(dr12_choord)
print('done matching')

# Convert to pandas first
fermi_table = QTable(fermi_data)
fermi_source_pd = fermi_table.to_pandas()
dr12_table = QTable(DR12_data)
sdss_source_pd = dr12_table.to_pandas()

fermi_sdss = fermi_source_pd.copy()

# Append the id and distance 
fermi_sdss['match_id'] = sdss_source_pd.iloc[idx].index.values
fermi_sdss['match_d2d_deg'] = d2d.deg

# Join the result
fermi_sdss= fermi_sdss.merge(sdss_source_pd, how='left',
                         left_on='match_id', right_index=True, 
                         suffixes=("_fermi", "_sdss"))

fermi_sdss_2 = fermi_sdss[fermi_sdss['match_d2d_deg'] <=2]

If I save this, I lose all information on the columns. ChatGPT says to do:

combined_header = fits.Header()
combined_header.extend(fermi_header.cards, useblanks=False, update=True)
combined_header.extend(DR12_header.cards, useblanks=False, update=True)

# Save the result as a FITS file with the combined header
combined_fits_file = filepath + "fermi_sdss_matches_possacc.fits"
hdu = fits.BinTableHDU(data=fermi_sdss_table, header=combined_header)
hdu.writeto(combined_fits_file, overwrite=True)

but when i open it with topcat i only have the dr12 header starting from column 1 instead of 169… is there a way to do this? thanks