swap file implementation error handling

When read length or write length is not equal to the page length the
process must terminate