Index: trunk/NEMO/OPA_SRC/DIA/diadimg.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diadimg.F90	(revision 1684)
+++ trunk/NEMO/OPA_SRC/DIA/diadimg.F90	(revision 1685)
@@ -57,5 +57,5 @@
     INTEGER :: jk, jn           ! dummy loop indices
     INTEGER :: irecl4,             &    ! record length in bytes
-         &       inum,             &    ! logical unit (set to 14)
+         &       inum,             &    ! logical unit
          &       irec                   ! current record to be written
     REAL(sp)                    :: zdx,zdy,zspval,zwest,ztimm
@@ -71,5 +71,4 @@
 
     irecl4 = MAX(jpi*jpj*sp , 84+18*sp + (jpk+8)*jpnij*sp  )
-    inum = 14
 
     zspval=0.0_sp    ! special values on land
Index: trunk/NEMO/OPA_SRC/DIA/diagap.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diagap.F90	(revision 1684)
+++ trunk/NEMO/OPA_SRC/DIA/diagap.F90	(revision 1685)
@@ -34,4 +34,5 @@
    INTEGER ::   nn_prg = 15   ! switch for control print
 
+   INTEGER ::   numgap                      ! logical unit for differences diagnostic
    INTEGER ::   nhoridg, ndepidg, ndex(1)   ! netcdf files and index common
 
Index: trunk/NEMO/OPA_SRC/DIA/diaptr.F90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 1684)
+++ trunk/NEMO/OPA_SRC/DIA/diaptr.F90	(revision 1685)
@@ -64,4 +64,5 @@
    INTEGER ::   niter
    INTEGER ::   nidom_ptr
+   INTEGER ::   numptr                                              !: logical unit for Poleward TRansports
 
    REAL(wp), DIMENSION(jpj,jpk) ::   tn_jk_glo  , sn_jk_glo       ! global       i-mean temperature and salinity
Index: trunk/NEMO/OPA_SRC/DIA/diawri_dimg.h90
===================================================================
--- trunk/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 1684)
+++ trunk/NEMO/OPA_SRC/DIA/diawri_dimg.h90	(revision 1685)
@@ -184,6 +184,6 @@
 #endif
        !
-       ! Output of dynamics and tracer fields and selected fields (numwri)
-       ! -----------------------------------------------------------------
+       ! Output of dynamics and tracer fields and selected fields
+       ! --------------------------------------------------------
        !
        !
@@ -361,5 +361,5 @@
 
        IF( lwp)WRITE(numout,*) ' '
-       IF( lwp)WRITE(numout,*) ' **** WRITE in numwri ',kt
+       IF( lwp)WRITE(numout,*) ' **** WRITE in dimg file ',kt
 
        IF( lwp .AND.        ll_dia_inst) WRITE(numout,*) '    instantaneous fields'
Index: trunk/NEMO/OPA_SRC/FLO/flowri.F90
===================================================================
--- trunk/NEMO/OPA_SRC/FLO/flowri.F90	(revision 1684)
+++ trunk/NEMO/OPA_SRC/FLO/flowri.F90	(revision 1685)
@@ -27,5 +27,6 @@
    PUBLIC   flo_wri    ! routine called by floats.F90
 
-   INTEGER ::   jfl    ! number of floats
+   INTEGER ::   jfl      ! number of floats
+   INTEGER ::   numflo   ! logical unit for drifting floats
 
    !! * Substitutions
@@ -297,4 +298,6 @@
       ENDIF 
 
+      IF( kt == nitend )   CLOSE( numflo ) 
+    
    END SUBROUTINE flo_wri
 
Index: trunk/NEMO/OPA_SRC/IOM/in_out_manager.F90
===================================================================
--- trunk/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 1684)
+++ trunk/NEMO/OPA_SRC/IOM/in_out_manager.F90	(revision 1685)
@@ -77,6 +77,6 @@
    INTEGER            ::   nn_jctls     =    0    !: Start j indice for the SUM control
    INTEGER            ::   nn_jctle     =    0    !: End   j indice for the SUM control
-   INTEGER            ::   nn_isplt      =    1   !: number of processors following i
-   INTEGER            ::   nn_jsplt      =    1   !: number of processors following j
+   INTEGER            ::   nn_isplt     =    1    !: number of processors following i
+   INTEGER            ::   nn_jsplt     =    1    !: number of processors following j
    INTEGER            ::   nn_bench     =    0    !: benchmark parameter (0/1)
    INTEGER            ::   nn_bit_cmp   =    0    !: bit reproducibility  (0/1)
@@ -90,15 +90,10 @@
    !!                        logical units
    !!----------------------------------------------------------------------
-   INTEGER            ::   numstp                 !: logical unit for time step
+   INTEGER            ::   numstp     =   -1      !: logical unit for time step
    INTEGER            ::   numout     =    6      !: logical unit for output print
-   INTEGER            ::   numnam                 !: logical unit for namelist
-   INTEGER            ::   numnam_ice             !: logical unit for ice namelist
-   INTEGER            ::   numevo_ice             !: logical unit for ice variables (temp. evolution)
-   INTEGER            ::   numsol                 !: logical unit for solver statistics
-   INTEGER            ::   numwri                 !: logical unit for output write
-   INTEGER            ::   numgap                 !: logical unit for differences diagnostic
-   INTEGER            ::   numbol                 !: logical unit for "bol" diagnostics
-   INTEGER            ::   numptr                 !: logical unit for Poleward TRansports
-   INTEGER            ::   numflo                 !: logical unit for drifting floats
+   INTEGER            ::   numnam     =   -1      !: logical unit for namelist
+   INTEGER            ::   numnam_ice =   -1      !: logical unit for ice namelist
+   INTEGER            ::   numevo_ice =   -1      !: logical unit for ice variables (temp. evolution)
+   INTEGER            ::   numsol     =   -1      !: logical unit for solver statistics
 
    !!----------------------------------------------------------------------
@@ -149,5 +144,8 @@
          IF( PRESENT(cd10) ) WRITE(numout,*) cd10
       ENDIF
-      CALL FLUSH(numout)
+                               CALL FLUSH(numout    )
+      IF( numstp     /= -1 )   CALL FLUSH(numstp    )
+      IF( numsol     /= -1 )   CALL FLUSH(numsol    )
+      IF( numevo_ice /= -1 )   CALL FLUSH(numevo_ice)
       !
    END SUBROUTINE ctl_stop
Index: trunk/NEMO/OPA_SRC/TRD/trdmld.F90
===================================================================
--- trunk/NEMO/OPA_SRC/TRD/trdmld.F90	(revision 1684)
+++ trunk/NEMO/OPA_SRC/TRD/trdmld.F90	(revision 1685)
@@ -721,4 +721,5 @@
       !! * Local declarations
       INTEGER :: jl
+      INTEGER :: inum   ! logical unit
 
       REAL(wp) ::   zjulian, zsto, zout
@@ -798,7 +799,7 @@
  
       IF( nn_ctls == 1 ) THEN
-         CALL ctl_opn( numbol, 'ctlsurf_idx', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, lwp )
-         READ ( numbol ) nbol
-         CLOSE( numbol )
+         CALL ctl_opn( inum, 'ctlsurf_idx', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, lwp )
+         READ ( inum ) nbol
+         CLOSE( inum )
       END IF
 
Index: trunk/NEMO/OPA_SRC/opa.F90
===================================================================
--- trunk/NEMO/OPA_SRC/opa.F90	(revision 1684)
+++ trunk/NEMO/OPA_SRC/opa.F90	(revision 1685)
@@ -386,11 +386,13 @@
       IF( lk_mpp )   CALL mppsync
       !
-      IF(lwp) CLOSE( numstp )   ! time-step file
-      IF(lwp) CLOSE( numsol )   ! solver file
-      !
-      CALL iom_close            ! close all input/output files
-      !
-      CLOSE( numnam )           ! namelist
-      CLOSE( numout )           ! standard model output file
+      CALL iom_close                                 ! close all input/output files managed by iom_*
+      !
+      IF( numstp     /= -1 )   CLOSE( numstp     )   ! time-step file
+      IF( numsol     /= -1 )   CLOSE( numsol     )   ! solver file
+      IF( numnam     /= -1 )   CLOSE( numnam     )   ! oce namelist
+      IF( numnam_ice /= -1 )   CLOSE( numnam_ice )   ! ice namelist
+      IF( numevo_ice /= -1 )   CLOSE( numevo_ice )   ! ice variables (temp. evolution)
+      IF( numout     /=  6 )   CLOSE( numout     )   ! standard model output file
+      numout = 6   ! redefine numout in case it is used after this point...
       !
    END SUBROUTINE opa_closefile
Index: trunk/NEMO/TOP_SRC/TRP/trdmld_trc.F90
===================================================================
--- trunk/NEMO/TOP_SRC/TRP/trdmld_trc.F90	(revision 1684)
+++ trunk/NEMO/TOP_SRC/TRP/trdmld_trc.F90	(revision 1685)
@@ -1213,4 +1213,5 @@
       !!
       !!----------------------------------------------------------------------
+      INTEGER :: inum   ! logical unit
       INTEGER :: ilseq, jl, jn
       REAL(wp) ::   zjulian, zsto, zout
@@ -1364,7 +1365,7 @@
       ! ----------------------------------------------
       IF( nctls_trc == 1 ) THEN
-         CALL ctl_opn( numbol, 'ctlsurf_idx', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, lwp )
-         READ ( numbol ) nbol_trc
-         CLOSE( numbol )
+         CALL ctl_opn( inum, 'ctlsurf_idx', 'OLD', 'UNFORMATTED', 'SEQUENTIAL', -1, numout, lwp )
+         READ ( inum ) nbol_trc
+         CLOSE( inum )
       ENDIF
 
