Fix infinite loop when writing a chunk. Add new exception.

This pull request fixes the infinite loop problem in the write_chunk function in region.py reported in issue #42. For that I have rewritten the function in a simpler form.

Also it adds a new exception that is raised when a file smaller than 8KiB in size is opened. In such a file there is not enough space for the region header and the file is most probably not a region file. Without this exception a very confusing error is thrown.

If there is anything that need changes before merging, please, let me know.