main: handling signals, added simple unique_fd RAII helper