remove sighup handler; refactor code to reopen()