koa middleware for signal handling