Add COPYING.
Fix close of invalid fd.
Makefile: use c99 instead of gnu99.