How it's supposed that workspace works?

In my package I’m opening a new workspace using and later if the user wants to open a new workspace I want to make sure that it doesn’t open the same again so I want to destroy the old one.

const pane = atom.workspace.paneForURI(uri)

if (pane) {

pane is always undefined so, how I’m suppose that I can find it?