Added mechanism for registering final post-simulation functions.