anchor.diff:     if (allocated(LinData%StateRel_x))    call WrPartialMatrix( LinData%StateRel_x,    Un, p_FAST%OutFmt, 'State_Rel_x' )
      if (allocated(LinData%StateRel_xdot)) call WrPartialMatrix( LinData%StateRel_xdot, Un, p_FAST%OutFmt, 'State_Rel_xdot' )
   
  -   close(un)
  +   close(Un)
  +   Un = -1
      
   END SUBROUTINE WrLinFile_txt_End   
   !----------------------------------------------------------------------------------------------------------------------------------
  
positive.code: !> Routine that writes the A,B,C,D matrices from linearization to a text file. 
  SUBROUTINE WrLinFile_txt_End(Un, p_FAST, LinData)
  
     INTEGER(IntKi),           INTENT(IN   ) :: Un                  !< unit number
     TYPE(FAST_ParameterType), INTENT(IN   ) :: p_FAST              !< parameters
     TYPE(FAST_LinType),       INTENT(IN   ) :: LinData             !< Linearization data for individual module or glue (coupled system)
     
  
negative.code:    
     ErrStat = ErrID_None
     ErrMsg = ""
     Un = -1
  
     
     LinRootName = TRIM(p_FAST%OutFileRoot)//'.'//trim(num2lstr(m_FAST%NextLinTimeIndx))
  