invoke callback after we're sure all writes are complete

plus misc