Creates output directories if they don't exist.