File upload question

I’ve got a problem with repaints after a forced upload has finished. Basically this is what I’m doing:

I’ve got a form in dialog ( subwindow), which allows the user to type in some stuff and also select a file as an attachment. I created
my own submit button (i.e. setting the buttonCaption to null). When the user presses submit, I upload the form data along with the file
and once it’s successful, I’m closing the window.

It’s all working, except that the window doesn’t close when the upload is complete. It only goes away after some user
action happens. When I open the dialog on a screen that’s using the refresher addon or if i reload the page, then the window goes away.

It seems to me that the client-side widget doesn’t know that upload is complete.

Any thoughts?

This is related to
Closing window from inside a thread