Wait for the message handler process to finish