[PTFM-6628] [PTFM-6629] Various Upload agent changes

 - Instead of compressing at level 0 (for chunks compressed < 5MB), we now
   append gzip of empty string at the end
 - Compiling UA with -O3 flag (instead of previous -g)
 - Bumping up version of UA to 1.2.7
 - Fixing thread race condition while printing to stderr (when catching bad_alloc)