fix linking of shared tap object & api_test.h bug

i think that tap.so has to come before libccan.a so that tap
symbols resolve from tap.so and not libccan.a

in api_test.h we were closing the tap output file in the child
but still using tap diag function calls. somehow this messes up the
child such that none of the data written to the pipe makes it through
to the parent.