This could be due to expansion of the WH’s PVC vent pipe. You can check its run at penetrations (ceiling, roof, any attic floor boards, etc,) and see if it’s tight at any of them. If it is tight, every time the warm exhaust gases start flowing through the pipe, PVC starts expanding and rubbing against those surfaces making noise. This could be happening as it is contracting / cooling down as well.
You should also check for tightness all WH’s PVC vent pipe joints (if there are any in your attic).