Fixed cursor closing for mysql log.