Rigid and flexible polyimide aerogels with less fatigue for use in harsh conditions