I just had this issue after removing the sim card. Turns out that Wifi was still "on" but somehow the iPhone got into a SOS mode only.
The fix: Go to settings, turn off wifi, turn it back on. Try to load a webpage in Safari and, if it works, try signing off of iCloud again.
If that doesn't work, try restarting your phone.
Topic:
App & System Services
SubTopic:
Hardware
Tags: