Thank you all for the comments. I added the $! and it prints "Disk quota exceeded". But it looks like I have available space. I run `df /path/to/the/file/which/we/try/to/open` and I have 57% free space. What could be the issue?
The message "Disk quota exceeded" is explicit - it means that your user's (or group's) disk quota has been exceeded, not that there is no space left on the device. See eg. repquota for more detail.