Move writing the EBML header to a seperate function.