Implement changes in #57: improve behaviour of dumped files

Here's a start on #57.
Questions:

1. When a file in read or append mode does not exists, the file currently points to os.devnull. Is this acceptable?
2. Do you think the test file is enough?
3. Should the IOErrors be replaced by UnpicklingErrors?
4. When the position is off the end of the file, in safe mode, should an exception be raised, or the position moved to the end?

Also, is this shabang malformed?