Make closefds.c portable.

Also, make it not crash when no arguments are provided.