lock on log files

i am writing to log files like this :

Function LogWrite
{
   Param ([string]$str,[bool]$bPrintDate=$true);
   if ($bPrintDate -eq $false) {
    Add-content $global:LogPathName -Encoding Unicode -value $str;
   }
   else {
       	$now=Get-Date;
    	$str=[string]::concat($now,"`t",$str);
       	Add-content $global:LogPathName -Encoding Unicode -value $str;
	}
}

and getting error :

Add-Content : The process cannot access the file 'D:\Logs\AD-AddUserManagers\20131113.log' because it is being used by another process.
i don't see reason for this, i don't have multiple process that write to the same log file?

this happens when i run the script from the second time in the same powershell window.

solved, i had email attachemnt in function that need the dispose method and locked the file