I'm using the following code for a file transfer:
Code:
Private Sub WinS_DataArrival(ByVal bytesTotal As Long)
On Error Resume Next
If WinS.Tag = "OK" Then
    Open App.Path & "\File.exe" For Binary As #1
End If
MsgBox "Recieved"
WinS.Tag = ""
Dim StrData() As Byte

WinS.GetData StrData, vbString
Debug.Print StrData

Put #1, , StrData
End Sub
WinS.Tag = "OK" when the transfer button is pushed.

Here's the question. How can I close #1 when the whole file is completed. Help me please!