Ensure MVar usage is exception-safe and use `throwIO`