more cleanup, print output sync, poll and wait for publishing completion