The "Invalid Argument" error is a result of the connection being closed, and Windows not telling the program about it. I don't know of anything that can be done about it... except of course switching to a decent OS, like Linux.