Fix shutdown issues

This patch fixes two issues which cause a unstoppable process.

The first one is that SIGTERM is ignored when it is called before starting default loop in engine.rb.  If you send SIGTERM immediately after starting fluentd, *@default_loop* is not set and the signal is ignored.  
`synchronize` method cannot be used in trap block, so I use a variable without semaphore for cheking the state.

The second issue is that shutdown of plugins are blocked because in_tail plugin contiues to reading logs. Shutdown of in_tail is blocked [here](https://github.com/fluent/fluentd/blob/master/lib/fluent/plugin/in_tail.rb#L80). `IOHandler ` keep reading logs independently in while loop if there are unread logs, so I fixed to stop reading on shutdown phaze.