Why not simply checking that the remaining space is greater than the current file size and only allow to save in that case?
Because that information is not available cheaply, portably for all filesystem types and platforms Geany is available on, if a save fails just save somewhere else and see what the problem is, it could be lots of things not just out of space.