Polyheteroarylene films with intrinsic switching mechanism for nonvolatile memory applications