closerequestfunction prevents window closing if empty