test record store file natives

Here are some tests for RecordStoreFile along with fixes for two bugs caught by the tests. To implement them, I also had to implement the RecordStoreFile.truncateFile native (and fs.ftruncate).

The bugs were:

1. RecordStoreFile.readBytes wasn't throwing IOException when the file descriptor was invalid or the range was out of bounds (as the reference implementation says it should do).
2. RecordStoreFile.closeFile wasn't flushing changes.