Added register_shutdown_function in example