fix fd leak
add makefile