It's really weird that you need this step: Perl should close it automatically once the controller goes out of scope (since the controller is the only thing left that holds a reference to the filehandle)

Could it be that the whole code is leaking controller objects?