add a temp file artifact, make resources closable and implement a database resource

closes #5