Fix some problems with clean termination of the go functions.
Finish -subdir option.