Nucleon spin structure functions at NNLO in the presence of target mass corrections and higher twist effects