add exit function to demo

add exit function to demo