Added file I/O protection to prevent potential crashes

-Files can now be open if they are opened by another application which
allows sharing open files.
-SUL data is sent to the temp directory if it cannot be written to the
default location.