Handle production/development writestream logic