Added support for filepaths and closing.