Change where the save/restore logic happens for enable_call_graph

It was possible to for the previous code to completely disable
enable_call_graph if an error happened in a trigger function.  This
should avoid that.