1. A method performed by a computing system, the computing system comprising a code transformation module and a resource monitoring module, the method comprising: with the resource monitoring module, providing to the code transformation module, a set of references to methods within a source code, the methods comprising code associated with a resource; with the code transformation module, creating a modified source code by inserting new code into the source code, the new code to close the resource at the end of each method referenced by the set of references; compiling the modified source code to create an application; with the resource monitoring module, during execution of the application, determining that an exception has occurred as a result of an attempt to access the resource when the resource is closed; and with the resource monitoring module, updating the set of references to include a new reference to a new method, the new method corresponding to the exception.