SetCloseOnDelete-methods function

set the close on delete behavior