Org-agenda provides the possibility to automatically restore the previous window configuration after closing the agenda buffer using org-agenda-quit (bound to q). This is achieved by setting org-agenda-restore-windows-after-quit to t.
However, there is also another way to "exit" the agenda, namely by calling org-agenda-switch-to (bound to RET) on an appropriate item. However, this command currently does not take the previous window configuration into account.
I thus propose adding a new variable named e.g. org-agenda-restore-windows-after-switch that controls whether the command org-agenda-switch-to will restore the previous window configuration before switching to the Org mode file of the item at point.
An example scenario where this is useful: Suppose you have a sophisticated window configuration and call org agenda with org-agenda-window-setup set to only-window. Then you want that window configuration to be restored also when exiting the agenda view via org-agenda-switch-to. Otherwise, you would lose your precious window configuration.
This behavior could be achieved by adding something like
(when (and org-agenda-restore-windows-after-switch org-agenda-pre-window-conf)
(set-window-configuration org-agenda-pre-window-conf))
before the call of pop-to-buffer-same-window within org-agenda-switch-to.