Added open/close plus some basic unit tests for them.