Nexus class does not work properly as context manager
Fix context manager issue with Nexus class