Properly handle certain failures during writing files.

This fixes a bug reported by Jon Daniels where trying to write to a read-only
filesystem (or read-only directory, etc.) would silently fail and make the
progress bar stick around indefinitely.

git-svn-id: https://valelab.ucsf.edu/svn/micromanager2/trunk@14435 d0ab736e-dc22-4aeb-8dc9-08def0aa14fd