Exposes a close method on files (and similar types), to permit finer grained error handling.
close
Inspired by [close-file], but more generic and works correctly on unix.
close-file