Revised cleanup code in openmp