Added forceclose option to read and write

The forceclose parameter will close the session when the function has
finished if true. Instead of starting a timer to wait if any more
read/write functions are called.

Warning: If you force close a file then try to push to it again, the
latest push will overwrite all data in the file (it does NOT append to
the file after it has been closed!)