refactoring closing fragments to just 'end'