Fix race bug in Quantile, fix Apply bug for frames

Quantiles - didn't block on closing writes.  Also clean up logic in main
loop a bunch.
Apply - if returning a Frame & applying to multi-columns, ref-cnt was
wrong on intermediate frames
Merge branch 'master' of github.com:0xdata/h2o