Vanilla windowWillClose_ question

Hi! I’m trying to make a vanilla window run a custom method before closing, in other words change its windowWillClose_ method. Is there a more correct way to do so than this? Creating a class and then ignoring it seems to be super awkward even though it sort of works. Any tips please?

from vanilla import FloatingWindow

try:
    # create class
	class W (FloatingWindow):
		def windowWillClose_( self, notification ):
			print('closing!')
except:
	# class already exist
	pass 

w = W((100, 100, 200, 200))
w.open()

Never mind! “Bind” is the proper way to do it.