ffserver: factor out connection closing from handler