OK. Is it possible your device does not have a memory card installed? Or, the memory is almost filled because of lots of files and apps? The code tells the File control to write to the card.
You are using USB to connect, can you run your code on the device using WIFI? If so, try it. Can you use the emulator? Try it.
Why? The issue could be using the USB connection. The issue might be there due to how the usb drivers on your PC use the data, but that is a guess.
Another way to try it is not to write to the card... do not use the / and have it write to the app internally. Not as flexible when you use the File control that way but it should work, even if your device does not have an sdCard.
Good luck. Yes, your code works fine on my devices.
-- Steve