A check is performed to see if the file is writable before doing much else - in this case you'll get an FTPException saying the file isn't writable, and you can catch this and all should be fine. However this check is only done if the file exists.
If the file doesn't exist, I suppose we could do the same thing on the directory, but this is notoriously unreliable in Java. The best test is to create the file and write to it, which is what the code does.
Your server doesn't seem to like the transfer being terminated. Post the debug file if you'd like us to take a look.
Probably the easiest thing to do is just to create the file first and try writing to it yourself, before attempting the transfer.