Prevent close default behaviour fix