Looks like what was happening is that on close the document is already removed from the session. This fix alters only the
case where methodToCall is "close" or null. In these cases, the document won't exist in the session; therefore, the only
thing left to do is redirect to the portal.

fixes rSmart/issues#296
fixes rSmart/issues#298
fixes rSmart/issues#299
Merge pull request #30 from leo-at-rsmart/rsmart-5.2.1

Fix for Exception on close