With the GUI open and items placed, if for some reason you are disconnected from the server (due to lag, kick, or whatever), your items are not sold, but they are not returned either; they disappear. The same thing happens if you are killed while the GUI is open.
I don't know if it's possible to return items (or, if it could cause an error or be very difficult to do, then it's possible to complete the sale even if the player has been kicked or killed).