Item12359: Refactor the DESTROY routines

Timothelitt pointed out that open / close should not break encapsulation
by living in separate files.   Use a Local package definition to define
the DESTROY routine, so that lock/unlock and open/close live in the same
file.

Also add the qw(-nofoswiki) to any use Foswiki::Time statements, so that
eachEvent doesn't break when used from configure

git-svn-id: http://svn.foswiki.org/trunk@17213 0b4bb1d4-4e5a-0410-9cc4-b2b747904278