fclose the file
Fixed small bug in valid_moves.
Replace test, train, and dump scripts with one.