Only try to close save dialog before destroying surface if it's currently open

Otherwise the closure promise will be rejected as it was already closed with
different data, if you ever opened and closed the save dialog before pressing
the 'Read' button. This means the code in the $.when will never be run, and
the surface never destroyed.

Bug: T75589
Change-Id: I3ffdd1c82506bcd2accc0f3fa113c0950a31918e
Merge "Only try to close save dialog before destroying surface if it's currently open"