fix close position
added method to handle parse errors
better error reporting