Great question.

By default all session scope CAS tables (temporary tables) are cleared from memory when you disconnect from the CAS server. The same thing happens when using Pandas. All DataFrames are cleared from memory when you close out of Python. This is the default behavior.

You have multiple options. You can save the table to disk, or you can promote the table to global scope:
- First you can save the table back to disk. To do that use the table.save CAS action: https://go.documentation.sas.com/doc/en/pgmsascdc/default/caspg/cas-table-save.htm. This is similar to saving a DataFrame using a to_method in pandas.
Example: castbl3.save(name='myfilesaved.csv', caslib='casuser')
You can specify any file extension, not just CSV.

- You can also promote a CAS table as a global scope table. That means that table will live in memory as a permanent table. One way to do this is to add the 'promote':True parameter in casout.
castbl3 = conn.upload_frame(df, casout = {'name':'heart_upload_frame',
'caslib':'casuser',
'promote':True})
https://go.documentation.sas.com/doc/en/pgmsascdc/default/caspg/cas-table-loadtable.htm#SAS.cas-table-loadtable-casout

More information on session scope (temp tables) vs global scope tables: https://go.documentation.sas.com/doc/en/pgmsascdc/default/casfun/n09ssmi0ko8uyfn1022ezo2hv0pm.htm#p0mbflp8ta6iq3n1aswoae5s5g76