Use at_exit instead of hacky finalizer

Current code is buggy and blocker of https://github.com/fluent/fluent-logger-ruby/issues/10 .

https://github.com/treasure-data/td-logger-ruby/commit/a72cc1365388b953d7128eae484905b059830491