Fix bug #161.

In C grades, closing a file stream multiple times can lead to a segmentation
fault on some systems (e.g. Linux), whereas on others (e.g. Mac OS X) an
io.error exception is thrown.  (The difference is due to differences in the
semantics of fclose.)  Try to avoid the former case by checking that the
stream handle is non-NULL before we attempt to close it.  (mercury_close zeros
out the relevant bits of the MercuryFile structure when we close a stream so,
the stream handle is set to NULL the first time we close the stream.)

library/io.m:
	As above.
Merge branch 'version-13_05-branch'