FileContext's _open() and _close() are called everytime their wrapper
is called, which tasks the caller with keeping track of whether they
were already called or not. Be a little easier on the caller, keep
track in an open count, and call _open() only once for multiple calls
to open(), and close() likewise. The caller still needs to make sure
the number of open() and close() calls matches.
Signed-off-by: Jan Lindemann <jan@janware.com>