Now only writes to type.sh and cbg.m when causality is completed.