ChessEngine: fix minor file descriptor leaks