LPS-39379 Prevent JS error if cmd input does not exist
LPS-39379 Do not reload form if page tree is not displayed.

Reloading form after closing the page dialog only makes sense if page tree is displayed, since the selected pages (and therefore the list of portlets) might have changed.
LPS-39379 - Source formatting