Instead of a command, attach a dynamic js behavior to ensure the callback is executed properly after everything else has run.