I ran the script without problems, and it seems it ran fine for you too, except at the end something went wrong when saving the NetCDF file. Try to specify an explicit filename for the NetCDF file (instead of using the default); one suspicion is that possibly you don't have privileges to create a file in the "default" location.