Fix order of function to call.
Change variable name.

     pid ->
childPid
Add process to close file pointer.