[fix] handle exit and error events of tail process

Ensures we exit cleanly in all cases. @indexzero