remove directories when finished
wait for outputs to close