add onTripClose to fix bug #34 and fix error caused from bug #30

- update demo-basic to include onTripClose use case