A MEL script does wait until the previous command completes.
The only exception to this rule is when a mel script generates ANOTHER mel command, as is the case with the MEL bake command, convertLightmapSetup
. convertLightmapSetup
spawns a call to convertLightmap
as it runs, and that call does not block.
So you have to call convertLightmap
directly, for your script to block.