[api] add a close event to manually end the redis pub/sub connection