Use Flatten & Background functions before changing the format to adjust the background color.
Also consider that you may not need to change the format to jpg, since the alpha layer is gone by applying Flatten function.
Smart jpg/png transformation. Detects transparency in the image. If transparency is found in the image, the output format will be set to png. Otherwise, the output format will be set to jpg.