added cleanup of tempdir and moves result to output

used if merging is False