How are you sending the message? If you are scripting it all, make sure you
are disposing the appropriate objects (FileStream and MailAttachment both
require disposing to close the file). If you are using a cmdlet and donâ€™t
have the ability to dispose, then try execute [GC]::Collect() to force
cleanup of resources and closing of the file.