finalize mnist demo