I'm running a set of tornado instances that handles many requests from a small set of keep-alive connections. When I take down the server for maintenance I want to gracefully close the keep-alive requests so I can take the server down.  Is there a way to tell clients "Hey this socket is closing" with Tornado?  I looked around and self.finish() just flushes the connection.
finish() doesn't apply here because a connection in the "keep-alive" state is not associated with a RequestHandler.  In general there's nothing you can (or need to) do with a keep-alive connection except close it, since the browser isn't listening for a response.  
Websockets are another story - in that case you may want to close the connections yourself before shutting down (but don't have to - your clients should be robust against the connection just going away).
Close all (keep-alive) socket connections in tornado?