Following your sample code, this will leave the outFile in use by the worker process:
Dim inFile As String = "infile.PDF" 'This is a sample PDF. Any PDF is fine.
Dim outFile As String = "outfile.PDF" 'This is a new file, it does not exist yet
Dim fileSecurity As Aspose.Pdf.Kit.PdfFileSecurity = New Aspose.Pdf.Kit.PdfFileSecurity(inFile, outFile)
fileSecurity.EncryptFile("password", "password", Aspose.Pdf.Kit.DocumentPrivilege.Print, Aspose.Pdf.Kit.KeySize.x128)
Once that code runs, it encrypts outfile.PDF. Now try to delete outfile.PDF from the directory. You can't. It's still open and in use. The only way to delete it would be to run IISRESET.
How can the file be released properly?
Using version 184.108.40.206 and IIS7.