If an after-effect cannot be fulfilled, can the action leading to that after-effect be performed?
You have played it correctly.

Abilities using the After keyword initiaite once you have finished resolving the trigger, not before, and when resolving a Forced ability, if it cannot change the state of the game, it just does not trigger at all.

From the rules reference (page 2 under Forced Abilities):


  
  If a forced ability does not have the potential to
  change the game state, the ability does not initiate.
  


and on page 3:


  
  A forced ability with a timing point beginning with the
  word “after...” automatically initiates immediately after that
  timing point’s impact upon the game state has resolved.
  


This means that as soon as the investigator has finished moving out of the location, they would then lose the listed actions/resources - it is an aftereffect of leaving, not a price you need to pay to leave.