Expression painter:close() detaches the QtLuaPainter object from the underlying widget. After doing this, you cannot draw anything. Painters operating on a widget or a printer should be closed before the underlying widget or printer is destroyed.