Th discarding of connections in maintenance mode must be done after any results have been written to them. This prevents closing of the connection before the actual result is returned.