Heading instability of moored ships in long waves