Change process and delete callbacks to also handle close in a separate function and not the destructor

This prevents the same potential double delete issue as was seen with CmdCallback