bug fix when writing moov metadata - didn't always wait till end of moov