Remove unnecessary "/" at end of pathname.