The problematic code/line is this
If Not File.Exists("./PalletQueue/Printer1" & ".txt") Then
File.Create("./PalletQueue/Printer1" & ".txt")
End If
File.Create returns a FileStream, that you need to close, if you want to write later to that file. Changing your code to the following should solve your problem.
If Not File.Exists("./PalletQueue/Printer1" & ".txt") Then
Dim file as FileStream = File.Create("./PalletQueue/Printer1" & ".txt")
file.Close()
End If