Write in binary mode for gz