Wrapped calls to Rprof and Rprofmem with a try() in close.profiling

Now they won't crash the job on systems without Rprofmem.  This should be
be safe, since the job will still fail in activate.profiling if the user
tries to use a profiler that's not installed.

They're individually wrapped since you want `Rprof(NULL)` to succeed even if `Rprofmem(NULL)` doesn't.