add mechanism to write ending tag

1. Without writing ending tag to gpx file in runtime, we check a
temporal file to write ending tag when machine starts.

need another idea for writing ending tag