Purification-induced sidewall functionalization of magnetically pure single-walled carbon nanotubes