Can not open jQuery UI dialog multiple times - test case included

Can not open jQuery UI dialog multiple times - test case included

I have prepared a simple test case to demonstrate my problem -

I use a jQuery UI button to open a jQuery UI dialog:

screenshot

However this works only once. On subsequent button clicks I get the error:

Uncaught Error: cannot call methods on dialog prior to initialization; attempted to call method 'open'

error in console