As I understand you are not able to close the 'fig1' and 'ux' windows.
In order to close the 'fig1' window, you can just use the close command as shown below:
>>close(fig1)
Now to close the 'ux' window you would need to get its corresponding figure handle and then use close command on it.('ux' is now specifying axes handle)
As 'ux' is created using uiaxes, the figure handle is hidden. Now inorder to get the figure handle and close the 'ux' window follow either one of the steps given below:
1. Get the figure handle using the following command:
>> uf = ux.Parent;
Then use the close command as shown:
>> close(uf)
2. After closing 'fig1', get the figure handle of 'ux' window using the findall command as shown:
>> uf = findall(0,'Type','figure');
Now use the close command to close the 'ux' window
>> close(uf)
You can find more information on the findall command in the following link: