OSHMEM: Fix application abort

register on_exit() hook to know exit status inorder to
skip shmem_finalize destructor in case of non-zero exit status