fix error handling

Currently, the example program does not close the RPC connection after using it.

In addition, it's using `System.exit(0)`, to stop the entire process including MessagePack-RPC eventloop thread.
As for example, it's better to just stop the EventLoop instead of stopping the whole process.