Fix for Exception on close

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