Fixed bug with saving state when closing window with no study loaded