How to properly uninstall flatpak

It seems this file in:

/etc/profile.d/flatpak.sh

was causing the issues. After deleting everything worked ok.