Check cram_eof() before calling cram_close()

...rather than after the file descriptor is gone.  Fixes #65.